Somehow I am struggling with the ticklabels of my plot. Here is my mwe:
\documentclass[a4paper]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.5}
\begin{document}
\begin{figure}
\begin{tikzpicture}
\begin{axis}[scaled ticks=false,
restrict x to domain=0:10,
xtick distance=1,
ytick distance=500,
restrict y to domain=0:3500,
ylabel = {test},
legend pos= {north west}
]
\addplot[no marks, blue] table [x=a, y=b] {data/testdata.txt};
\addlegendentry{test}
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
The dataset:
a b
1 370
2 740
3 1110
4 1480
5 1850
6 2220
7 2590
8 2960
9 3330
This produces the following:
Now I want to replace the yticklabel 3000 with the unit so I added the following line after ytick distance:
yticklabels={0, 500, 1000, ..., 2500, unit, 3500},
But now the y domain starts at 500 and ends at 4000 and the labels 0 and 500 are missing. What am I doing wrong? Whats the best way to replace just one ticklabel?




0at the origin? – sporc Mar 16 '18 at 06:26xmin=0andymin=0to theaxisoptions. – Stefan Pinnow Mar 16 '18 at 07:30