# How do I change the font size of the axis tick labels in pgfplots?

Surely this question must have been asked before, but I cannot find it and my searches through the user's guide are proving fruitless.

I have the following graph:

% arara: pdflatex
% arara: pdflatex
% arara: open
\documentclass{standalone}
\usepackage{pgfplots}

\pgfplotsset{every axis/.append style={
axis x line=middle,    % put the x axis in the middle
axis y line=middle,    % put the y axis in the middle
axis line style={<->,color=blue}, % arrows on the axis
xlabel={$x$},          % default put x on x-axis
ylabel={$y$},          % default put y on y-axis
}}

\begin{document}

\newcommand\aea{4}%%
\newcommand\aer{%%
(3* \aea * sin(x) * cos(x))/((sin(x))^3+(cos(x))^3)}%%
\newcommand\aex{\aer*cos(x)}%%
\newcommand\aey{\aer*sin(x)}%%

\begin{tikzpicture}
\begin{axis}[
xmin=-7,xmax=7,
ymin=-7,ymax=7,
grid=both,
xtick={-6,-5,...,5,6},
ytick={-6,-5,...,5,6},
]
%% the asymptote:
\end{axis}
\end{tikzpicture}

\end{document}


I would like to change the size of the fonts along the axes so that the numbers don't overlap each other (yes I want all those numbers there!).

You can use to adjust the style to the tick labels:

\pgfplotsset{every tick label/.append style={font=\tiny}}


If you want to also shift the tick labels closer to the axis you can use:

\pgfplotsset{every x tick label/.append style={font=\tiny, yshift=0.5ex}}
\pgfplotsset{every y tick label/.append style={font=\tiny, xshift=0.5ex}}


• And if I wanted to position those labels closer to the axes, would you have any suggestions? – A.Ellett Oct 15 '14 at 2:33
• Updated answer posted. – Peter Grill Oct 15 '14 at 2:36

You can also use ticklabel style = {font=\tiny} in the axis options or \pgfplotsset.

If you want separate styles, you can use

        yticklabel style = {font=\tiny,xshift=0.5ex},
xticklabel style = {font=\tiny,yshift=0.5ex}


Full code:

% arara: pdflatex
% arara: pdflatex
% arara: open
\documentclass{standalone}
\usepackage{pgfplots}

\pgfplotsset{every axis/.append style={
axis x line=middle,    % put the x axis in the middle
axis y line=middle,    % put the y axis in the middle
axis line style={<->,color=blue}, % arrows on the axis
xlabel={$x$},          % default put x on x-axis
ylabel={$y$},          % default put y on y-axis
}}

\begin{document}

\newcommand\aea{4}%%
\newcommand\aer{%%
(3* \aea * sin(x) * cos(x))/((sin(x))^3+(cos(x))^3)}%%
\newcommand\aex{\aer*cos(x)}%%
\newcommand\aey{\aer*sin(x)}%%

\begin{tikzpicture}
\begin{axis}[
xmin=-7,xmax=7,
ymin=-7,ymax=7,
grid=both,
xtick={-6,-5,...,5,6},
ytick={-6,-5,...,5,6},
yticklabel style = {font=\tiny,xshift=0.5ex},
xticklabel style = {font=\tiny,yshift=0.5ex}
]