LaTex Plot Axis 3D

There are many packages in LaTeX to plot 3D, including tikz-3dplot, and other exotic packages.

The easiest one to use for plotting a simple 3D graph, with xyz axis and origin, is Pgfplots in my opinion.

The code to plot the diagram below is included for reference.

First, we need to add the following in the preamble of the LaTeX document:


Then, to draw the actual diagram, the following simple code will do:

  axis lines=center,

% plot dots for the points
\addplot3 [only marks] coordinates {(1,2,3) (4,5,6)};

% plot dashed lines to axes
\addplot3 [no marks,densely dashed] coordinates {(1,2,3) (4,5,6)};

% label points
\node [above] at (axis cs:1,2,3) {$A (1,2,3)$};
\node [above right] at (axis cs:4,5,6) {$B (4,5,6)$};
\node [below left] at (axis cs:0,0,0) {$O$};

Author: mathtuition88

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.