[Tex/LaTex] Resize font in legend below \tiny

fontsizelegendpgfplots

I have small graph in my presentation (I have to). To adjust the size of the legend, I have to use very small legend. But \tiny is not enought.

Here is a MWE :

\documentclass{beamer}
\usepackage{etex}
\usepackage[frenchb]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{epstopdf}
\usepackage{tikz}
\usepackage{circuitikz}
\usepackage{pstricks}
\usepackage{array}
\usepackage{graphicx}
\usepackage{filecontents}

\begin{filecontents}{data.dat}
x,y
1,2
2,3
3,4
\end{filecontents}

\begin{document}
\begin{frame}
\begin{tikzpicture}
    \begin{axis}[
        legend style={font=\tiny},
        xlabel={x},
        ylabel={y},
        width=4cm, height=3cm,
        ymin=0,
        xmin=0,
        xmajorgrids, xminorgrids, ymajorgrids,
    ]   
    \addplot table [col sep=comma]{data.dat};
    \addlegendentry{Test Test Test};
    \end{axis}  
\end{tikzpicture}
\end{frame}
\end{document}

Giving this :

enter image description here

Best Answer

beamer has the additional font switch \Tiny that will give you a smaller size than \tiny (if your current font supports this size); if this is not enough, you can use \fontsize{<size>}{<baselineskip>}\selectfont with appropriate values.

enter image description here

The code:

\documentclass{beamer}
\usepackage{etex}
\usepackage[frenchb]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{epstopdf}
\usepackage{tikz}
\usepackage{circuitikz}
%\usepackage{pstricks}
\usepackage{array}
\usepackage{graphicx}
\usepackage{filecontents}

\begin{filecontents}{data.dat}
x,y
1,2
2,3
3,4
\end{filecontents}

\begin{document}
\begin{frame}
\begin{tikzpicture}
    \begin{axis}[
        legend style={font=\fontsize{4}{5}\selectfont},
        xlabel={x},
        ylabel={y},
        width=4cm, height=3cm,
        ymin=0,
        xmin=0,
        xmajorgrids, xminorgrids, ymajorgrids,
    ]   
    \addplot table [col sep=comma]{data.dat};
    \addlegendentry{Test Test Test};
    \end{axis}  
\end{tikzpicture}
\end{frame}
\end{document}