Can someone explain me (MWE derived from this 3D Box example):
- Why below MWE produces whitespace on the left in the second picture? This is caused by the 2 set-
coords. If you comment them out, the space is gone, but the box does not look the same anymore - How can I make the coordinates local instead of global? The problem is that they are now directly in the
tikzpictureparameters, so I cannot move them inside thetikzpictureenvironment. Well you can move them inside, but then it does not work anymore (second picture will then looks the same as the first picture).
MWE
\documentclass{article}
\usepackage[table,dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\tdplotsetmaincoords{60}{125}
\tdplotsetrotatedcoords{0}{0}{0} %<- rotate around (z,y,z)
\begin{document}
\framebox {
\begin{tikzpicture}[scale=1,tdplot_rotated_coords,
cube/.style={very thick,black},
grid/.style={very thin,gray}]%
\draw[cube,fill=green!10] (0,0,0) -- (0,2,0) -- (2,2,0) -- (2,0,0) -- cycle;%
\end{tikzpicture}
}
\framebox{
% If you comment these 2 lines out the space is gone (but not correctly rotated anymroe)
\tdplotsetmaincoords{35}{125}
\tdplotsetrotatedcoords{0}{0}{0} %<- rotate around (z,y,z)
% ---
\begin{tikzpicture}[scale=1,tdplot_rotated_coords,
cube/.style={very thick,black}]%
\draw[cube,fill=green!10] (0,0,0) -- (0,2,0) -- (2,2,0) -- (2,0,0) -- cycle;%
\end{tikzpicture}
}
\end{document}
