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):

enter image description here

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

enter image description here

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

  • 4
    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, 2013 at 16:50
  • Yes, that's what I want. Although it may reduce readability...
    – DaPhil
    Feb 8, 2013 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, 2013 at 21:43

1 Answer 1


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.



    % styles which are used in more than one place below:
    trafo x/.style={
        sloped like x axis,
    trafo y/.style={
        sloped like y axis,
    trafo z/.style={
        %sloped like z axis,
        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,
        zticklabel style={trafo z},



enter image description here

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .