# Distance of the labels from the axis

I am a beginner with the package TikZ. I am using pgfplots to produce a very simple plot. The code I am using has been copied from an example found on the web, but my output is different from the example I saw.

This is the code:

\pgfplotsset{   width=0.45\linewidth,
xmin=0,xmax=100,
ymin=0,ymax=1,
grid=major
}
\begin{tikzpicture}
\begin{axis}[
xlabel=Percentage,
ylabel=Accuracy]
\addplot[smooth,mark=*,blue] plot coordinates {
(11,0.6)
(15,    0.71)
(19,    0.7)
(25,    0.74)
(32,    0.73)
(40,    0.78)
(50,    0.81)
(51,    0.79)
(55,    0.79)
(56,    0.79)
(58,    0.77)
(61,    0.77)
(69,    0.77)
};
[...]


In the output the labels of the axis ticks are too close to the line. Is there any way to move the farther away? [I cannot post an image because my reputation is too low]

I have read the manual and checked other questions, but I cannot find the option/command I need to use.

While writing the minimal example as requested in the comments, I discovered that I see that problem only when the document class is baposter. With the article class it works ok.

The minimal working example with class baposter follows:

\documentclass[a0paper,portrait]{baposter}

\usepackage{graphicx}

\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}

\begin{poster}{
grid=false,
colspacing=0.7em,
eyecatcher=false,
bgColorOne=white,
background=plain,
} %poster
% eyecatcher
{

}
% title
{
TITLE
}
%Authors
{
AUTHORS
}
% Logo
{

}

\pgfplotsset{width=0.45\linewidth,
xmin=0,xmax=100,
ymin=0,ymax=1,
grid=major
}
\begin{tikzpicture}
\begin{axis}[
xlabel=p,
ylabel=a]
\addplot[smooth,mark=*,blue] plot coordinates {
(11, 0.6)
(15, 0.71)
(19, 0.7)
(25, 0.74)

};
\end{axis}
\end{tikzpicture}

\end{poster}

\end{document}

-
Hi Antonio, welcome to the site! I can't reproduce this, unfortunately. Could you turn your code snippet into a complete minimal example document, so starting from \documentclass and including all the options that are necessary to reproduce the problem (and only those)? –  Jake Feb 13 '13 at 10:21
Hello, thanks for the answer. I discovered that there is no problem when using the article class. I was using the class baposter: I posted a minimal example with that document class. –  Antonio Sesto Feb 13 '13 at 14:03

This happens because the baposter class puts all its contents into a tikzpicture with the option inner sep=0pt, outer sep=0pt, which is passed on to your tikzpicture, causing the tick label nodes to be printed without any padding. You can reset the padding by adding inner sep=0.333em, outer sep=0.5\pgflinewidth to your tikzpicture options (those are the default values):

\documentclass[a0paper,portrait]{baposter}

\usepackage{graphicx}

\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}

\begin{poster}{
grid=false,
colspacing=0.7em,
eyecatcher=false,
bgColorOne=white,
background=plain,
} %poster
% eyecatcher
{

}
% title
{
TITLE
}
%Authors
{
AUTHORS
}
% Logo
{

}

\pgfplotsset{width=0.45\linewidth,
xmin=0,xmax=100,
ymin=0,ymax=1,
grid=major
}
\begin{tikzpicture}[inner sep=0.3333em, outer sep=0.5\pgflinewidth]
\begin{axis}[
xlabel=p,
ylabel=a]
\addplot[smooth,mark=*,blue] plot coordinates {
(11, 0.6)
(15, 0.71)
(19, 0.7)
(25, 0.74)

};
\end{axis}
\end{tikzpicture}

\end{poster}

\end{document}

-
Thank you very much. Indeed, it is the first time I am using baposter and tikz. –  Antonio Sesto Feb 13 '13 at 15:05

You could use nodes instaed of xlabel and ylabel. You can place the nodes where you want by defining the right position.

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{plotmarks, arrows, shapes, backgrounds, shadows, positioning, calc, fit}

\begin{document}

\pgfplotsset{   width=0.45\linewidth,
xmin=0,xmax=100,
ymin=0,ymax=1,
grid=major
}
\begin{tikzpicture}
\begin{axis}[
%xlabel=Percentage,
%ylabel=Accuracy
]
\addplot[smooth,mark=*,blue] plot coordinates {
(11,0.6)
(15,    0.71)
(19,    0.7)
(25,    0.74)
(32,    0.73)
(40,    0.78)
(50,    0.81)
(51,    0.79)
(55,    0.79)
(56,    0.79)
(58,    0.77)
(61,    0.77)
(69,    0.77)
};

\end{axis}

\node at (1.5cm,-0.8cm) {Percentage};
\node at (-1cm,1.5cm) [rotate=90, anchor=base] {Acccuracy};
\end{tikzpicture}

\end{document}

-