7

I'm having an issue with pgfplots/tikz when trying to change the font size for legends/nodes. Any command that contains "font=\size" fails (for example, "font=\small") with the error "Undefined control sequence \end{axis}".

Here is a MWE.

\documentclass[]{minimal}

\usepackage{paralist,pst-func, pst-plot, pst-math, pstricks-add,pgfplots}
\usetikzlibrary{patterns,matrix,arrows}
\pgfplotsset{compat=1.9}

\begin{document}

\begin{tikzpicture}
%\tikzstyle{every node}=[font=\small] % throws "Undefined control sequence \end{axis}"
\begin{axis}
%[legend style={font=\tiny}] % throws "Undefined control sequence \end{axis}"
\addplot[blue, ultra thick] (x,x*x);
\addlegendentry{ Class 1};
\end{axis}
\end{tikzpicture}
\end{document}

1 Answer 1

10

You are using minimal document class where font size commands will not be available (Refer this answer). Use some other class and things work:

\documentclass[]{standalone}

\usepackage{paralist,pst-func, pst-plot, pst-math, pstricks-add,pgfplots}
\usetikzlibrary{patterns,matrix,arrows}
\pgfplotsset{compat=1.9}

\begin{document}

\begin{tikzpicture}
\begin{axis}
[legend style={font=\tiny}] % works
\addplot[blue, ultra thick] (x,x*x);
\addlegendentry{ Class 1};
\end{axis}
\end{tikzpicture}
\end{document} 

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .