3d cube with x,y,z directional vectors

  • Context: MHB 
  • Thread starter Thread starter Dustinsfl
  • Start date Start date
  • Tags Tags
    3d Cube Vectors
Click For Summary

Discussion Overview

The discussion focuses on how to plot a 3D cube with directional vectors in the x, y, and z axes using various programming and typesetting tools such as Mathematica, Matlab, and TikZ in LaTeX. Participants explore different methods and clarify requirements for the cube's representation.

Discussion Character

  • Technical explanation
  • Exploratory

Main Points Raised

  • One participant inquires about the specific requirements for plotting the cube, asking whether the origin should be at the center or a vertex.
  • Another participant clarifies that they do not need the x, y, z axes, emphasizing the need for a cube in free space with only vectors.
  • Multiple participants provide similar TikZ code snippets to illustrate how to create the cube and vectors, indicating a potential method for achieving the desired plot.
  • One participant references a specific section of the TikZ manual for further details on the XYZ coordinate system.

Areas of Agreement / Disagreement

Participants have not reached a consensus on the specific requirements for the cube's representation, as there are differing interpretations regarding the inclusion of axes and the cube's positioning.

Contextual Notes

Some limitations include the lack of clarity on the desired visual outcome and the potential need for additional context regarding the use of the TikZ library.

Dustinsfl
Messages
2,217
Reaction score
5
How can I plot a 3d cube with x,y,z directional vectors going through it?

Mathematica or Matlab or Tikz package Latex
 
Physics news on Phys.org
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?
 
Evgeny.Makarov said:
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.
 
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.
 

Attachments

  • cube.png
    cube.png
    756 bytes · Views: 120
Evgeny.Makarov said:
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}

https://www.physicsforums.com/attachments/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}
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K