Take the 2-minute tour ×
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 am using Pgfplots to make a very simple graph. I already have the code below

  axis x line=center,
  axis y line=center,
  xlabel style={below right},
  ylabel style={above left},
\addplot [mark=none,domain=-4:4] {x};

What I need is to be able to use symbols other than numbers in the axes. So, instead of 1 2 3 4... I would like to have, for instance, + + _ _ + + or other symbols for each point in the axes. How can I do that? I hope my question is clear!

share|improve this question
Do you mean something like xticklabels={$-$, $-$, $-$, $-$, $-$, $+$, $+$, $+$, $+$, $+$, $+$}? –  Jake Feb 7 '13 at 13:43
Yes, I meant that. I used that but then I got only 4 points in the x axis. Then I added your suggestion after xtick={-5,-4,...,5}, and it worked. Do you know how to add those same symbols to the diagonal axis? –  KleinePrins Feb 7 '13 at 13:55
Welcome to TeX.SX. –  Claudio Fiandrino Feb 7 '13 at 13:57
@Eduardo.D: With "diagonal axis", do you mean the plot you added using \addplot ...? –  Jake Feb 7 '13 at 13:58
If you want to do a 3D plot, use \addplot3 and take a look at Section 4.5 of the pgfplots manual. –  Psirus Feb 7 '13 at 14:24

1 Answer 1

up vote 3 down vote accepted

Maybe you'd be better served with a "real" 3D axis. Here's a small example that shows how to create one (the key point is that you need an \addplot3 command with at least one coordinate:


    x={(1,0)}, y={(0.6,0.4)}, z={(0,1)},
    axis lines=middle, 
    axis equal image,
    xmin=-4.5, xmax=4.5,
    ymin=-4.5, ymax=4.5,
    zmin=-4.5, zmax=4.5,
    xtick={-5,...,5}, xticklabels={$-$, $-$, $-$, $-$, $-$,, $+$, $+$, $+$, $+$, $+$, $+$},
    ytick={-5,...,5}, yticklabels={$-$, $-$, $-$, $-$, $-$,, $+$, $+$, $+$, $+$, $+$, $+$},
    ztick={-5,...,5}, zticklabels={$-$, $-$, $-$, $-$, $-$,, $+$, $+$, $+$, $+$, $+$, $+$},
    xticklabel style={anchor=north},
    yticklabel style={anchor=north west, inner sep=1pt},
    zticklabel style={anchor=east},
\addplot3  [draw=none] coordinates {(0,0,0)};

share|improve this answer
This is exactly what I had in mind! Thanks a lot Jake! Also thanks to @Psirus. I am a newbie but I will try to learn something from that long manual. –  KleinePrins Feb 7 '13 at 14:44
@Eduardo.D: You're welcome, I'm glad it helps. If you consider this question answered, you can mark it as such by clicking the tick mark next to the answer and upvoting it by clicking the upward-pointing triangle. –  Jake Feb 7 '13 at 14:45

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.