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)
};
\addlegendentry{legend}
[...]
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.
Could you please help me?
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
{
}
\headerbox{header}{name=header,column=0,row=0,span=4}{
\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)
};
\addlegendentry{legend}
\end{axis}
\end{tikzpicture}
} % headerbox
\end{poster}
\end{document}
Best Answer
This happens because the
baposter
class puts all its contents into atikzpicture
with the optioninner sep=0pt, outer sep=0pt
, which is passed on to yourtikzpicture
, causing the tick label nodes to be printed without any padding. You can reset the padding by addinginner sep=0.333em, outer sep=0.5\pgflinewidth
to yourtikzpicture
options (those are the default values):