I want to modify my three-dimensional Cartesian coordinate system as shown in the picture attached.
- I would like to have numbers under my ticks.
- I want parts of the grid to be parallel to the x_1 axis.
What changes have to be made to my code?
MWE:
\documentclass{scrartcl}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{center}
\begin{tikzpicture}
\draw[gray!60!white, thick] (-4.99,-4.99) grid (9.99,9.99);
\draw[->, >=latex, ultra thick] (0,0,-2.6) -- (0,0,13) node[left]{$x_1$};
\draw[->, >=latex, ultra thick] (0,0,0) -- (10,0,0) node[below]{$x_2$};
\draw[->, >=latex, ultra thick] (0,0,0) -- (0,10,0) node[left]{$x_3$};
\foreach \z in {2.6,5.2,7.8,10.4}
\draw[shift={(0,0,\z)}, ultra thick] (0pt,0pt,0pt) -- (0pt,-0.21pt,0pt);
\foreach \x in {2,4,6,8}
\draw[shift={(\x,0)}, ultra thick] (0pt,0pt) -- (0pt,-6pt);
\foreach \y in {2,4,6,8}
\draw[shift={(0,\y)}, ultra thick] (0pt,0pt) -- (-6pt,0pt);
\draw[fill=green!50!white, nearly transparent] (0,0,0) -- (0,0,12.7) -- (0,9.9,12.7) -- (0,9.9,0);
\draw[fill=blue!50!white, nearly transparent] (0,0,0) -- (9.9,0,0) -- (9.9,9.9,0) -- (0,9.9,0);
\draw[fill=red!50!white, nearly transparent] (0,0,0) -- (9.9,0,0) -- (9.9,0,12.7) -- (0,0,12.7);
\draw[blue, ultra thick, ->] (4,0,5.2) -- (4,4,5.2);
\draw[red, ultra thick, ->] (0,0,5.2) -- (4,0,5.2);
\draw[green, ultra thick, ->] (0,0,0) -- (0,0,5.2);
\shade[ball color=yellow] (4,4,5.2) circle (0.2);
\end{tikzpicture}
\end{center}
\end{document}
Best Answer
With some styles and
declare function
for constants. The grids are drawn manually with one loop, the ticks with labels with a second loop. Use thescale
parameter to adjust the size of the diagram.