I have the following function in pgfplots:

\begin{tikzpicture}% coordinates
\begin{axis}[xlabel=$x$,ylabel=$y$, axis lines = center, every axis plot/.append style={ultra thick}, ymin=-1,ymax=7]
\addplot [domain=-3:3, samples=100, color=blue,]{x^2};

This prints out the following:enter image description here

I'd like to remove the tick labels (but keep the ticks) on everything except the min/max on the axes. So I'd like it to look like this: enter image description here

To that end, it'd be nice to be able to label any tick I wanted to while keeping the ticks visible on the non-labelled ones. This seems simple but I can't seem to figure it out. Thanks in advance!

1 Answer 1


If you already know the values, then you can do it easily. One way is to disable all the ticklabels and then label only required ticks.


\begin{axis}[axis equal,
xlabel=$x$,ylabel=$y$, axis lines = center, every axis plot/.append style={ultra thick},
xticklabels={},yticklabels={}, % remove ticklabels
xtick distance=1, ytick distance=2, % set the tick distance
extra x ticks={-3,3},extra y ticks={6}, % add required labels
\addplot [domain=-3:3, samples=100, color=blue,]{x^2};

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.