# Does pgfplots support “spatial” plotting?

As the title states, I like to know if I can plot "spatial" with pgfplots. And I think I have to explain what I mean by that (I couldn't find a good expression in english):

In a pgfplots 3d plot, the axis labels are just rotated in one direction. Example (taken from pgfplots project page at sourceforge.net):

In contrast, what I would like to see, is this example, done with Origin (taken from the OriginLab website):

So the question is, can I achieve that also with pgfplot?

-
Do you want the axis labels to be rendered as if they lay in the x-y-plane? I think this is not a good idea since it decreases the readability … –  Tobi Feb 8 '13 at 16:50
Yes, that's what I want. Although it may reduce readability... –  DaPhil Feb 8 '13 at 21:12
I think one of the things which I really miss from pgfplots is that there is no possibility of automated perspective, like the second image you posted. –  Manuel Feb 8 '13 at 21:43

Pgfplots has builtin for rotated axis descriptions using the sloped (or slope like x axis) keys.

Adding "spatial" labels might be possible with custom transformations. I am thinking of x/y slant transformations which are applied after the builtin rotations.

Such a transformation would, of course, depend on the actual view direction (i.e. the choice of view={<h>}{<v}).

For the standard view direction, the following could be a starting point which may be useful - or really just a starting point for manual fine tuning.

\documentclass{standalone}

\usepackage{pgfplots}

\tikzset{
% styles which are used in more than one place below:
trafo x/.style={
sloped like x axis,
xslant=1,
},
trafo y/.style={
sloped like y axis,
xslant=-1,
anchor=north,
},
trafo z/.style={
%sloped like z axis,
yslant=1,
anchor=east,
},
}
\pgfplotsset{
spatial/.style={
xlabel style={trafo x},
xticklabel style={trafo x},
ylabel style={trafo y},
yticklabel style={trafo y},
% z was more tricky. This is my current guess:
every axis z label/.style={%
at={(ticklabel cs:0.5)},rotate=-90,
xslant=-1,
anchor=north,
},
zticklabel style={trafo z},
},
}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
min=0,
max=1,
xlabel=xlabel,
ylabel=ylabel,
zlabel=zlabel,
spatial,
]
\end{axis}
\end{tikzpicture}
\end{document}


Clearly, the positions of labels might need some correction and the slant values are just guesses.

If you want to elaborate on how this should really be done, you can automatically compute a suitable transformation matrix given two axes. For example, the pgfplots macro pgfplotstransformtoaxisdirection{<axis>} installs a PGF basic level transformation matrix which implements the sloped feature (<axis> is one of x, y, or z). I am sure a similar method could be implemented to support spatial plots which look "well enough". If you come up with a general implementation along with tests for many view directions, I can add the result to pgfplots.

-