# No content in zoom Tikz spy

I'm trying to use the spy glass in Tikz, but for some reason my zoom area is always empty and (some) graphs tend to disappear when I use spy. I've updated all my packages etc. through the updater by MikTeX but this didn't solve anything. The code I use:

\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{spy}

\begin{document}
\begin{tikzpicture}
[spy using outlines={rectangle, magnification=3,connect spies}]

\begin{axis}[grid=major,no markers,domain=-5:5,enlargelimits=false]
\coordinate (spypoint) at (axis cs:0,0);
\coordinate (spyviewer) at (axis cs:0.5,-90);
\end{axis}
\spy[width=6cm,height=1cm] on (spypoint) in node [fill=white] at (spyviewer);

\end{tikzpicture}

\begin{tikzpicture}
%[spy using outlines={rectangle, magnification=3,connect spies}]

\begin{axis}[grid=major,no markers,domain=-5:5,enlargelimits=false]
%\coordinate (spypoint) at (axis cs:0,0);
%\coordinate (spyviewer) at (axis cs:0.5,-90);
\end{axis}
%\spy[width=6cm,height=1cm] on (spypoint) in node [fill=white] at (spyviewer);

\end{tikzpicture}
\end{document}


I'm not allowed to upload an image here since I'm new, but the red and blue graphs disappear with the spy glass, where the black dot remains. The areas of the spy glass are correct, but also the black dot doesn't appear in the zoom area, it's completely empty. When not using spy, the graphs appear perfectly fine...

-
Here, with TeXLive 2012, your code is ok. And with TeXLive 2009, all is ok except the black mark that does not appear in the graph or in the zooming area (pgfplots is too old). –  Paul Gaborit Jul 11 '12 at 13:10
Ok, thanks for the info PolGab, I'll try it on a different machine perhaps that will work. I'll keep you posted! –  Blaatschaap Jul 11 '12 at 15:23
I get the same result as PolGab with texlive 2010. Can you elaborate on your build path? I think pgfplots may interact weirdly with some of the possibilities. (The version I have has an explicit warning about dvipdfm in the source, for example.) I'm building successfully with latexmk -pdf FWIW. –  kgr Jul 11 '12 at 15:54

You could try subbing in the newest version of this library to your pgf installation (source code here). However I tried doing this and it didn't quite work, though it behaved differently than the buggy behavior (which, incidentally, I was able to replicate) -- the spy part worked but the plot part didn't. Possibly I was doing something wrong and I didn't try very hard. But probably you would need to install the development version of the whole package to fix this bug in the meantime, rather than just updating this one file. Or give up on .ps as you say :).
kgr you got me on the right track! I was converting with LaTeX => PS => PDF because of .eps figures. Then also on my other machine it didn't work, same stuff. But with LaTeX => PDF it works fine! I was already busy changing .eps to .tikz so skipping PS is no problem. Thanks! –  Blaatschaap Jul 11 '12 at 18:28