# PGFPLOTS 3d box line for Z axis not being drawn

The vertical 3d box line for Z axis is not being drawn. If I make the grid lines dashed, the line is drawn, but also appears dashed, as the grid lines.

To me, it looks that the line is in fact drawn, but it seems to be behind the grid (that's why it would appear dashed with the dashed grid).

UPDATE: Just confirmed, if I remove grids with grids = none the box line appears.

Any way to fix this?

MWE (for dashed, just uncomment the grid style line):

\documentclass[12pt,a4paper]{report}
\usepackage[latin1]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.3}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
width=8cm,
height=8cm,
grid = major,
%grid style={dashed, gray!50},
scale only axis,
xmin=-2, xmax=2,
xtick={-2,-1,0,1,2},
xlabel={X},
ymin=-2, ymax=2,
ytick={-2,-1,0,1,2},
ylabel={Y},
zmin=0, zmax=4,
ztick={0,1,2,3,4},
zlabel={Z},
3d box=background,
view={322.5}{30},]

color=black,
mark size=2.5pt,
only marks,
mark=*,
mark options={solid}]
table {
-0.25 -0.25 3
};
color=black,
mark size=2.5pt,
only marks,
mark=*,
mark options={solid}]
table {
-0.25 0.25 3
};
color=black,
mark size=2.5pt,
only marks,
mark=*,
mark options={solid}]
table {
0.25 0.25 3
};
color=black,
mark size=2.5pt,
only marks,
mark=*,
mark options={solid}]
table {
0.25 -0.25 3
};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}


Results:

-
Your problem seems to go away with \pgfplotsset{compat=1.7} instead of \pgfplotsset{compat=1.3} so is appears that this bug has been fixed in newer versions. –  Peter Grill Jan 7 '13 at 3:18
Actually, in my original file I have \pdfplotsset{compat=newest} but I tried changing it to \pdfplotsset{compat=newest} and it gives me an error. Any easy way to check my pgfplots version? –  perr0 Jan 7 '13 at 3:30
Indeed, there was an update, which I applied. Now I can set \pgfplotsset{compat=1.7}, but I stil get the same problem. Did you get a different result? –  perr0 Jan 7 '13 at 3:55
You must be using old packages. I am using the latest updated TeXLive2012 and I get a solid z axis with \pgfplotsset{compat=newest} and grid style={dashed, gray!50},. BTW you need to use the @ followed by the userid to ensure that I am notified of the message. –  Peter Grill Jan 7 '13 at 4:55
@PeterGrill Just updated everything. In fact, there were a lot of old packages. It seemed to solve the problem, but then on the real plot (not the MWE) the black line is not so thick as the others, but this changes with the zoom level. Maybe it's going to be good when printed. Thank you. –  perr0 Jan 7 '13 at 6:00
You can solve the issue by added set layers to your axis. This activates layered graphics for your tikzpicture, and the layers are drawn in the correct sequence. The default is to the single axes individually, which can cause the observed effect. Setting set layers should not have any negative effect on the appearance and the small additional runtime cost is probably irrelevant.
The feature set layers is relatively new and requires pgfplots 1.7