2

I am using Pgfplots to make a very simple graph. I already have the code below

\documentclass{article}
\usepackage{tikz,pgfplots}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[>=latex]
\begin{axis}[
  axis x line=center,
  axis y line=center,
  xtick={-5,-4,...,5},
  ytick={-5,-4,...,5},
  xlabel={$x$},
  ylabel={$y$},
  xlabel style={below right},
  ylabel style={above left},
  xmin=-10.5,
  xmax=10.5,
  ymin=-10.5,
  ymax=10.5]
\addplot [mark=none,domain=-4:4] {x};
\end{axis}
\end{tikzpicture}
\end{document}

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!

1 Answers1

3

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:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    scale=1.5,
    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)};
\end{axis}
\end{tikzpicture}
\end{document}

Jake
  • 232,450
  • 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. – EduDominic Feb 07 '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 07 '13 at 14:45