Hi,
I'm creating a few charts using the pgfplots library. One of those charts has "distance" on the x axis, but the generated image has ticks with a 2km interval (0 2 4 6 ... 14).
How can I tell pgfplots to generate x ticks with, for example, a 0.5 interval between ticks (0.5 1 1.5 2 2.5 ... 14)?
Best regards.
Graphics, Figures & Tables ⇒ pgfplots | Increase the Number of x Ticks
NEW: TikZ book now 40% off at Amazon.com for a short time.

pgfplots | Increase the Number of x Ticks
This, from the pgfplots manual, should do the trick:
Code: Select all
\begin{tikzpicture}
\begin{axis}[
xtick={-1.5,-1,...,1.5},
xticklabels={%
$-1\frac 12$,
$-1$,
$-\frac 12$,
$0$,
$\frac 12$,
$1$},
% note: \frac can be done automatically:
% xticklabel style={/pgf/number format/frac},
]
\addplot[smooth,blue,mark=*]
coordinates {
(-1, 1)
(-0.75, 0.5625)
(-0.5, 0.25)
(-0.25, 0.0625)
(0, 0)
(0.25, 0.0625)
(0.5, 0.25)
(0.75, 0.5625)
(1, 1)
};
\end{axis}
\end{tikzpicture}