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.
pgfplots
is that there is no possibility of automated perspective, like the second image you posted.