TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I really like the arrow tips shown in How to get rid of the viewer's (incorrect) axes in an Asymptote 3D graphics and am wondering how to produce this in pgfplots:

enter image description here enter image description here

I admit I have not tried yet, but adapting something like the solutions from Cut-off cone in TikZ seems a bit much, so before I pursue that thought I would see if this was already available in some 3D library.

The code below is a reduced version from Drawing Axis Grid in 3D with Custom Unit Vectors and sets up a basic 3d axis and grid.




\NewDocumentCommand{\DrawCoordinateGrid}{O{} m m m m m m}{%
    \begin{scope}[canvas is xy plane at z=0, thick, red]
      \draw [#1] (\XGridMin,\YGridMin) grid (\XGridMax,\YGridMax);
    \begin{scope}[canvas is yz plane at x=0, thin, blue]
      \draw [#1] (\YGridMin,\ZGridMin) grid (\YGridMax,\ZGridMax);
    \begin{scope}[canvas is xz plane at y=0, thin, orange]
      \draw [#1] (\XGridMin,\ZGridMin) grid (\XGridMax,\ZGridMax);

\NewDocumentCommand{\DrawCoordinateAxis}{O{} m m m m m m}{%
    \begin{scope}[thin, gray, -latex]
        \draw [#1] (\XAxisMin,0,0) -- (\XAxisMax,0,0) node [below left] {$x$};
        \draw [#1] (0,\YAxisMin,0) -- (0,\YAxisMax,0) node [right] {$y$};
        \draw [#1] (0,0,\ZAxisMin) -- (0,0,\ZAxisMax) node [above] {$z$};

    x={(1.0cm,0.0cm)}, y={(0.0cm,1.0cm), z={(-0.5cm,-0.1cm)}}% All grids are ok

    \DrawCoordinateAxis[thick, black]{0}{5}{0}{5}{0}{5}
share|improve this question
Related Question: 3D arrows with TikZ. – Peter Grill Jul 15 at 11:51
up vote 13 down vote accepted


It's possible to get a better integration. The first try gives this code



     ball color=#1,
     shift = {#2},
     (0,0) -- (75:.8mm) arc (75:105:.8mm)--cycle; 
\begin{tikzpicture}[x = {(\axexthreed)},
                    y = {(\axeythreed)},
                    z = {(\axezthreed)},
                    scale = 4]
   \begin{scope}[canvas is zy plane at x=0]
     \draw[green!50!blue] (.5,.5) circle (.5cm); 
     \draw [green!50!blue,step=.1] (0,0) grid (1,1);  
   \begin{scope}[canvas is zx plane at y=0]
     \draw[blue!50!red] (.5,.5) circle (.5cm); 
     \draw [blue!50!red,step=.1] (0,0) grid (1,1); 
   \begin{scope}[canvas is yx plane at z=0]
     \draw[red!50!green] (.5,.5) circle (.5cm);
     \draw [red!50!green,step=.1] (0,0) grid (1,1);   

\draw[red]   (0,0,0) -- (.95,0,0)    node[red,left=6pt]    {$x$}; 
\draw[green] (0,0,0) -- (0,.95,0)    node[green,right=6pt] {$y$}; 
\draw[blue]  (0,0,0) -- (0,0,.95)    node[blue,above=6pt]  {$z$};       

enter image description here

share|improve this answer
These look very good. Have you a way to wrap this into a macro, or a style setting to make it easier to use? Also should use math mode for the axis labels. – Peter Grill Apr 10 '12 at 21:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.