For adding zero lines to every plot produced by pgfplots, I used the code provided by percusse here. (A quick note after 2 replies were provided: this is a "global" solution. If one likes to add the zero lines to one plot only, see esdd's reply.)
The zero lines are the last item added to every axis environment so they'll get drawn over anything that was drawn before. This is a bit ugly in the case that a pin or node is next to/on the y-axis. Of course I can move some pins' positions by changing their parameters but all in all, some will have to stay near/on the y-axis so it isn't possible for all pins.
Is this possible to solve? Or would anyone have to offer some advice anyway?
Picture of Problem
MWE
\documentclass{article}
\usepackage{pgfplots}
\tikzset{
every pin/.style={
draw=black,
fill=white
},
every pin edge/.style={
draw=black!60,
fill=white,
thick
},}
\pgfplotsset{
every axis/.append style={
%
xmajorgrids={true},
ymajorgrids={true},
xminorgrids={false},
yminorgrids={false},
%
after end axis/.code={
% \fill[red] (axis cs:0,0) circle(5pt);
\draw[thin] (axis cs:\pgfkeysvalueof{/pgfplots/xmin},0) -- (axis cs:\pgfkeysvalueof{/pgfplots/xmax},0);
\draw[thin] (axis cs:0,\pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:0,\pgfkeysvalueof{/pgfplots/ymax});
},
},
every tick/.append style={
black,
thick
},
/pgf/number format/.cd,
use comma,
1000 sep={.},
}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot {rand};
\filldraw (axis cs:0.9,0.9) circle [radius=1pt];
\node[pin={[pin distance=0.3cm]180:{0.9} }] at (axis cs:0.9,0.9) {};
\node[pin=0:{0.9}] at (axis cs:0.9,0.9) {};
\end{axis}
\end{tikzpicture}
\end{document}