# Multi axis plot problem with appearance

I have a problem with the appearance of a mutli axis plot...

Currently I have the following:

However I do not want the arrow in the right y-axis but from the documentation I read that the * in the axis y line command should prevent this... but it doesn't. Further the upper axis, where the second x axis would appear, is now gray I however want it to be black. Hopefully someone knows the right commands to fix this.

\documentclass{standalone}
\usepackage{graphics,siunitx}
\usepackage{tikz,pgfplots}
\begin{document}
\begin{tikzpicture}
\pgfplotsset{%
compat=1.6,
width=10cm,
height=7cm,
scale only axis,
every x tick label/.append style={font=\scriptsize\color{gray!80!black}},
xmajorgrids,
xminorgrids,
every y tick label/.append style={font=\scriptsize\color{gray!80!black}},
ymajorgrids,
yminorgrids
}

\begin{axis}[%
xmin=0, xmax=40000,
xlabel={Time},
ymin=-50, ymax=50,
ylabel={Power},
axis y line*=left,
axis x line*=bottom]
color=red,
solid
]
coordinates{(0,0};
\label{pcharge}
color=green,
solid
]
coordinates{(0,0)};
\label{pbattery}
\end{axis}

\begin{axis}[%
xmin=0, xmax=40000,
ymin=0, ymax=100,
ylabel={State of charge},
axis lines=left,
axis y line*=right,
axis x line=none,
legend style={at={(1.15,1)},anchor=north west,nodes=right}]

color=blue,
solid
]
coordinates{(0,0)};
\addlegendentry{$SOC$};

\addlegendimage{/pgfplots/refstyle=pcharge}\addlegendentry{$P_\mathrm{charge}$};
\addlegendimage{/pgfplots/refstyle=pbattery}\addlegendentry{$P_\mathrm{battery}$};
\end{axis}
\end{tikzpicture}
\end{document}

-
 You may also want to consider \pgfplotsset{use layers} right after your \begin{tikzpicture}[..] statement(s) -- this improves multi-axis-plots. – Christian Feuersänger Jan 19 at 11:13

This happens because you issued axis lines=left before axis y line*=right. If you remove axis lines=left, the arrow disappears. This looks like a bug, so you might want to file a bug report.

\documentclass[border=5mm]{standalone}
\usepackage{graphics,siunitx}
\usepackage{tikz,pgfplots}
\begin{document}
\begin{tikzpicture}
\pgfplotsset{%
compat=1.6,
width=10cm,
height=7cm,
scale only axis,
every x tick label/.append style={font=\scriptsize\color{gray!80!black}},
xmajorgrids,
xminorgrids,
every y tick label/.append style={font=\scriptsize\color{gray!80!black}},
ymajorgrids,
yminorgrids
}

\begin{axis}[%
xmin=0, xmax=40000,
xlabel={Time},
ymin=-50, ymax=50,
ylabel={Power},
axis y line*=left,
axis x line*=bottom]
color=red,
solid
]
coordinates{(0,0)};
\label{pcharge}
color=green,
solid
]
coordinates{(0,0)};
\label{pbattery}
\end{axis}

\begin{axis}[%
xmin=0, xmax=40000,
ymin=0, ymax=100,
ylabel={State of charge},
axis y line*=right,
axis x line=none,
legend style={at={(1.15,1)},anchor=north west,nodes=right}]
color=blue,
solid
]
coordinates{(0,0)};
\addlegendentry{$SOC$};

\addlegendimage{/pgfplots/refstyle=pcharge}\addlegendentry{$P_\mathrm{charge}$};
\addlegendimage{/pgfplots/refstyle=pbattery}\addlegendentry{$P_\mathrm{battery}$};
\end{axis}
\end{tikzpicture}
\end{document}

-
Thanks. Further any know how, how to make the top line to black? Normally when I use these settings for axis style a all the outer lines are black. – WG- Jan 18 at 13:23
@WG-: That happens because you're setting axis x line*=bottom for both axes, which means the top line isn't drawn. If you remove the option from the first axis and set xmajorgrids=false for the second, it should work. – Jake Jan 18 at 13:46