Assume you have a trigonometric function, say for simplicity sin(x)
. When plotting the function, how can one place the x-axis markers on 0, pi/2, pi, 3pi/2, 2pi, instead of the default numeric values that pgfplots
uses?
[Tex/LaTex] Pgfplots with custom axis markers
pgfplots
Best Answer
Use
\xtick
to specify where you want the ticks, and\xticklabels
to specify the corresponding labels.If you don't want a label a particular tick mark, just leave that one blank. For example, if you did not want the label at pi you would replace the line with
xticklabels={$0$,$\frac{\pi}{2}$,,$\frac{3\pi}{2}$}
.