When doing polar plots in pgfplots (v1.10) I get additional whitespace when loading the units library. How can I get rid of that?

I did not observe this before since it is related to the direction of the y axis, as can be seen from the code below when comparing with a plot without the xmin and xmax setting. Removing the units library gives the correct spacing.

\documentclass[convert,TikZ]{standalone}

\usepackage{pgfplots}

\usepgfplotslibrary{%
units,
polar,
}
\pgfplotsset{
}

\begin{document}
\fboxsep=0pt
\fbox{%
\begin{tikzpicture}
\begin{polaraxis}[
xmin=-180,xmax=180,
]
\addplot coordinates {(0,1) (90,1) (180,1) (270,1) (360,1)};
\end{polaraxis}
\end{tikzpicture}%
}

\end{document}


You can get rid of it, even if you are loading units, by adding the option use units=false. This fixes it in your minimal example. Since it actually doesn't use units, it makes no harm there.

\documentclass[convert,TikZ]{standalone}

\usepackage{pgfplots}

\usepgfplotslibrary{%
units,
polar,
}
\pgfplotsset{
}

\begin{document}
\fboxsep=0pt
\fbox{%
\begin{tikzpicture}
\begin{polaraxis}[use units=false,
xmin=-180,xmax=180,
]
\addplot coordinates {(0,1) (90,1) (180,1) (270,1) (360,1)};
\end{polaraxis}
\end{tikzpicture}%
}

\end{document}


If you let TikZ actually draw all nodes, you will see the node containing just whitespace, which causes that space:

\begin{tikzpicture}[every node/.style={draw}]


So, either

• check if siunitx produces whitespace even for an empty value and send a bug report
• send a bug report or feature request for pgfplots to actually switch off the labels instead of not printing them, which fails with units

or both.

• Thanks, Stefan, that solves my problem. With your experience, can you tell me if this is a bug and worth a bug report? Or is there some concept I don't understand that causes this behaviour? (I tend to believe it's a bug but am not sure.) – Chris Jul 5 '14 at 16:10
• @Chris I extended my answer a bit. Yes, it's worth a bug report. – Stefan Kottwitz Jul 5 '14 at 16:29
• Probably units library doesn't check if the labels are empty or not and appends itself next to the empty label. – percusse Jul 5 '14 at 17:04
• Thanks for all your analysis. This is a bug in pgfplots. It will be fixed in version 1.11 (which comes in the next weeks). – Christian Feuersänger Jul 8 '14 at 7:10