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



    \coordinate (O) at (0,0,0);

    \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;

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?


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

closed as unclear what you're asking by Paul Gessler, Andrew Swann, user13907, Mensch, yo' Sep 2 '14 at 11:48

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    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. – Peter Grill Feb 22 '13 at 7:08
  • @user494461 have Peter's suggestions helped you answer your question? – Paul Gessler Aug 19 '14 at 1:52

Browse other questions tagged or ask your own question.