Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to label the axes in a 3D plot with pgfplots. Using the anchors .right of origin and .above origin, I can label the axes as "x" and "y" in 2D with ease. In 3D, the labels must be tweaked to appear in the correct place, and I have no simple way of labeling the x-axis. Is there an anchor that directly relates to these positions? The MWE below shows what I've produced so far.

\begin{tikzpicture}
\begin{axis}%
[width=175pt,tick label style={font=\scriptsize},axis on top,
axis lines=center,
y dir=reverse,
name=myplot,
ymin=-1.1,ymax=1.1,
xmin=-1.1,xmax=1.1,
zmin=-1.1, zmax=1.1
]
\end{axis}
\node [right] at (myplot.right of origin)[shift={(-20pt,-8pt)}] {\scriptsize $y$};
\node [above] at (myplot.above origin) [shift={(0,-20pt)}] {\scriptsize $z$};
\end{tikzpicture}

enter image description here

share|improve this question
Why don’t you use the options xlabel, ylabel and zlabel? Although they are bugged in the current version (Axis label placement in 3d plot far out but why?), this should be much better. To avoid updating you can use the axis cs coordinate system as in pgfplots: labels and width issues in non-boxed 3d plot with oblique projection. Not related to your question, but you might be interested in the enlargelimits option. – Qrrbrbirlbel Feb 28 at 18:37
I didn't know the xlabel, etc., options existed (and I do read the manuals... apparently just not very well). I do get the bugs you alluded to; I'll see if the workarounds provided there help or will wait for a stable pgfplots update. – GregH Feb 28 at 18:52

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.