# How do I change properties of a cube in TikZ? [closed]

I am looking at an example from How to draw a cube with TikZ where all faces have a distinct color?

\documentclass{minimal}
\usepackage{tikz,tikz-3dplot}

\begin{document}
\tdplotsetmaincoords{70}{115}

\begin{tikzpicture}[scale=4,tdplot_main_coords]
\coordinate (O) at (0,0,0);
\tdplotsetcoord{P}{1.414213}{54.68636}{45}

\draw[fill=gray!50,fill opacity=0.5] (O) -- (Py) -- (Pyz) -- (Pz) -- cycle;
\draw[fill=blue,fill opacity=0.5] (O) -- (Px) -- (Pxy) -- (Py) -- cycle;
\draw[fill=yellow,fill opacity=0.5] (O) -- (Px) -- (Pxz) -- (Pz) -- cycle;
\draw[fill=green,fill opacity=0.5] (Pz) -- (Pyz) -- (P) -- (Pxz) -- cycle;
\draw[fill=red,fill opacity=0.5] (Px) -- (Pxy) -- (P) -- (Pxz) -- cycle;
\draw[fill=magenta,fill opacity=0.5] (Py) -- (Pxy) -- (P) -- (Pyz) -- cycle;
\end{tikzpicture}
\end{document}


I want to draw many cubes like these, I wanted to know which line changes the position of the center of the cube, and the orientation?

I want all cubes to be of same size.

what are x, y and z? are they values? are they being multiplied with P?

--------edit-----------

is there a package for TikZ where I can simply draw cubes by providing their size, color and position and orientation?

• For this kind of question it really is just best to try to change one parameter at a time and see the effect, especially since this is a small amount of code. Start with the \tdplotsetmaincoords setting and go from there. Commented Feb 22, 2013 at 7:08
• @user494461 have Peter's suggestions helped you answer your question? Commented Aug 19, 2014 at 1:52