Welcome to our community

Be a part of something great, join today!

[SOLVED] 3d cube with x,y,z directional vectors

dwsmith

Well-known member
Feb 1, 2012
1,673
How can I plot a 3d cube with x,y,z directional vectors going through it?

Mathematica or Matlab or Tikz package Latex
 

Evgeny.Makarov

Well-known member
MHB Math Scholar
Jan 30, 2012
2,502
Do you still need help with this? There are many examples on the web. Do you need the origin to be in the center of the cube or in one of its vertices?
 

dwsmith

Well-known member
Feb 1, 2012
1,673
Do you still need help with this? There are many examples on the web. Do you need the origin to be in the center of the cube or in one of its vertices?
I don't need a x,y,z axis. A cube in free space only with vectors. I still need help.
 

Evgeny.Makarov

Well-known member
MHB Math Scholar
Jan 30, 2012
2,502
This is one way.

Code:
 \usetikzlibrary{arrows}
 \begin{tikzpicture}[>=stealth',x=2cm,y=2cm,z=0.77cm]
 \fill (0,0) circle (1.5pt);
 \draw (0,0) -- (1,0) -- (1,1) -- (0,1) -- cycle;
 \begin{scope}[shift={(0,0,1)}]
 \draw (0,0) -- (1,0) -- (1,1) -- (0,1) -- cycle;
 \end{scope}
 \draw (0,0) -- (0,0,1) (0,1) -- (0,1,1) (1,0) -- (1,0,1) (1,1) -- (1,1,1);
 \end{tikzpicture}
cube.png

For the description of the XYZ coordinate system, see section 22.2 on p. 249 in the v. 2.10 TikZ manual.
 

dwsmith

Well-known member
Feb 1, 2012
1,673
This is one way.

Code:
 \usetikzlibrary{arrows}
 \begin{tikzpicture}[>=stealth',x=2cm,y=2cm,z=0.77cm]
 \fill (0,0) circle (1.5pt);
 \draw (0,0) -- (1,0) -- (1,1) -- (0,1) -- cycle;
 \begin{scope}[shift={(0,0,1)}]
 \draw (0,0) -- (1,0) -- (1,1) -- (0,1) -- cycle;
 \end{scope}
 \draw (0,0) -- (0,0,1) (0,1) -- (0,1,1) (1,0) -- (1,0,1) (1,1) -- (1,1,1);
 \end{tikzpicture}
View attachment 362

For the description of the XYZ coordinate system, see section 22.2 on p. 249 in the v. 2.10 TikZ manual.
Code:
\begin{tikzpicture}[>=stealth',x = 2cm,y = 2cm,z = 0.77cm]
 \draw[->] (.9,159/110,0)-- (-.5,-107/110,0) node[anchor = south east]{$\frac{\partial }{\partial y}$};
 \draw[->] (-1.3,.15) -- (1.5,.15) node[anchor = north east]{$\frac{\partial }{\partial x}$};
 \draw[->] (.15,-1.3) -- (.15,1.5) node[anchor = north east]{$\frac{\partial }{\partial z}$};
 \draw (-.5,-.5) -- (.5,-.5) -- (.5,.5) -- (-.5,.5) -- cycle;
 \begin{scope}[shift = {(0,0,1)}]
 \draw (-.5,-.5) -- (.5,-.5) -- (.5,.5) -- (-.5,.5) -- cycle;
 \end{scope}
 \draw (-.5,-.5) -- (-.5,-.5,1) (.5,-.5) -- (.5,-.5,1) (.5,.5) -- (.5,.5,1) (-.5,.5) -- (-.5,.5,1);
\end{tikzpicture}