11

I have the following code which I copied from here How to draw the unit hyperbola in LaTex?, and rotated it. The axis labels font is too large. Going through the manual and deveral posts, am not able to settle my problem. I tried to put {font size=tiny at various location, nothing changes. Help will be appreciated

\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=5cm,compat=1.12}
% axis style, ticks, etc
\pgfplotsset{every axis/.append style={font=\tiny}{
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={->}, % arrows on the axis
`xlabel={\footnotesize$x^{'}$},          % default put x `on x-axis
                ylabel={\footnotesize$y^{'}$},{font=\tiny}          % 
default put y on y-axis
                rotate=40.0}}
% arrows as stealth fighters
\tikzset{>=stealth}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
            xmin=-5,xmax=5,
        ymin=-5,ymax=5]
        \addplot [red,domain=-2:2] ({cosh(x)}, {sinh(x)});
    \addplot [red,domain=-2:2] ({-cosh(x)}, {sinh(x)});
    \addplot[red,dashed] expression {x};
    \addplot[red,dashed] expression {-x};
\end{axis}
\end{tikzpicture}

\end{document}
  • the easiest way is to simply add on of the predefined styles normalsize, small, footnotesize or tiny to the axis environment. – Stefan Pinnow Mar 24 '16 at 14:22
16

You can modify font size of labels and tick labels with label style={font=\tiny} and tick label style={font=\tiny}

\documentclass[tikz]{standalone}
\usepackage{pgfplots}

% axis style, ticks, etc
\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={<->}, % arrows on the axis
                    xlabel={$x$},          % default put x on x-axis
                    ylabel={$y$},          % default put y on y-axis
                    label style={font=\tiny},
                    tick label style={font=\tiny}  
                    }}

% arrows as stealth fighters
\tikzset{>=stealth}

\begin{document}

\begin{tikzpicture}
    \begin{axis}[
            xmin=-5,xmax=5,
        ymin=-5,ymax=5]
        \addplot [red,thick,domain=-2:2] ({cosh(x)}, {sinh(x)});
        \addplot [red,thick,domain=-2:2] ({-cosh(x)}, {sinh(x)});
        \addplot[red,dashed] expression {x};
        \addplot[red,dashed] expression {-x};
    \end{axis}
\end{tikzpicture}

\end{document}
  • 1
    thanks @salim bou, I inserted the suggested code. The document works but still there is no change in the font. – Zilore Mumba Mar 24 '16 at 14:44
  • You mean labels and tick labels? answer updated. – Salim Bou Mar 24 '16 at 15:09
  • I mean the numbers on the axes – Zilore Mumba Mar 24 '16 at 15:20
  • thanks once more, on a second attempt the font has now changed. I appreciate your help. – Zilore Mumba Mar 24 '16 at 19:07
  • thanks very much, on a second attempt, the fonts changed. I really appreciate your help. Sorry for repeating, I thought did not pass earlier on – Zilore Mumba Mar 25 '16 at 6:46

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.