5

In order to include a cross through the origin in my plot, I write the following under \begin{axis}:

extra x ticks={0},
extra y ticks={0},
extra tick style={grid=major},

However, the 0s appear in bold face in my plot. How can I prevent this?

andreasdr
  • 615
  • 2
    Can you please include a simple example? Make sure that it is not printed twice that might create an illusion. – percusse Jun 01 '12 at 15:10
  • Your code-snippet doesn't demonstrate the problem- please make a complete MWE – cmhughes Jun 01 '12 at 15:26
  • For getting zero lines in your plot, take a look at How can I add a zero line to a plot? – Jake Jun 01 '12 at 15:29
  • I just noticed that you seem to be using Joseph Wright's solution from the question I linked to. You forgot to also use the option extra y tick labels=,, which switches off the labels for the extra ticks. – Jake Jun 01 '12 at 15:32
  • Yes, I noticed that Joseph Wright's example was similar, but didn't notice the line turning off the extra tick labels (I also didn't understand that that was the reason for the boldface-looking 0s). Thanks! – andreasdr Jun 01 '12 at 16:13

1 Answers1

8

You're printing the labels twice, once with the regular ticks, once with the extra x ticks and extra y ticks, which looks as if they're printed bold. You'll need to switch the extra labels off, by using extra y tick labels={} and extra x tick labels={}.

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    extra x ticks={0}, extra x tick labels={},
    extra y ticks={0}, extra y tick labels={},
    extra tick style={grid=major},
]
\addplot{rand};
\end{axis}
\end{tikzpicture}

\end{document}
Jake
  • 232,450