# pgfplots: two labelings for a single 3d plot

I am trying to add a second labeling to my 3d plot, but I can not figure out how to do it correctly. The idea is to add a second axis without any grid, ticks, lines and nothing but labels and overlay it over the first plot. However, I seem not to be able to

1. Place the second axis labels correctly and
2. Make the second axis invisible except for its labels.

This is a short example of what I do:

\begin{tikzpicture}

% This is the plot itself
\begin{axis}[domain=-1:1,view={135}{45},xlabel style={sloped},ylabel style={sloped},zlabel style={sloped},xlabel=$x$,ylabel=$y$,zlabel=$z$]
\end{axis}

% This is the invisible plot that should only add labels to the first plot
\begin{axis}[domain=-1:1,view={135}{45},grid=none,xlabel style={sloped},ylabel style={sloped},xlabel=$X$,ylabel=$Y$,xtick=\empty,ytick=\empty,ztick=\empty,axis z line=none,x axis line style={transparent},y axis line style={transparent}]
\addplot3[mark=none] coordinates {(0,0,0)}; % for a correct viewing angle
\end{axis}

\end{tikzpicture}


I attached a file that shows what I actually get and implies (in red) what I try to get. It is not good to see in this example, but transparency does not work as expected, the lines of the second "invisible" plot are still clearly visible and naturally drawn on top of the first plot.

My picture: Black is what I have, red is what I would like to have.

I would be glad if anyone had an idea how to fix this. Or maybe there is a totally different way how this can be achieved.

-
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. Also, I uploaded your image using the official stackexchange interface, i.e. the image icon on top of the text field, and added it to the post. This ensures that all images are always accessible and do not expire. – Torbjørn T. Nov 14 '11 at 15:42

Torbjorn's solution already has the correct placement. The rotation can be achieved by means of sloped like x axis and its variants:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=-1:1,view={135}{45},
xlabel style={sloped},
ylabel style={sloped},
zlabel style={sloped},
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
clip=false]
\node at (rel axis cs:0,0.5,1) [above,sloped like y axis] {a long $x$ label};
\node at (rel axis cs:0.5,0,1) [above,sloped like x axis] {a long $y$ label};
\end{axis}
\end{tikzpicture}
\end{document}


Note that sloped is actually an alias to one of the sloped like x axis variants inside of an axis.

-

You could use the rel axis cs coordinate system and add the labels manually.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=-1:1,view={135}{45},xlabel style={sloped},ylabel style={sloped},zlabel style={sloped},xlabel=$x$,ylabel=$y$,zlabel=$z$,clip=false]
\node at (rel axis cs:0,0.5,1) [above,rotate=-25] {$X$};
\node at (rel axis cs:0.5,0,1) [above,rotate=25] {$Y$};

@Bernd Not that I know, but then I hardly know my way around pgfplots. Give it some time though, and there's a good chance someone with a better solution reads the question. – Torbjørn T. Nov 14 '11 at 17:29