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]
\addplot[solid,mark=asterisk,mark options={solid},color=blue] {x^2};
\addplot[solid,mark=asterisk,mark options={solid},color=red] {x^3};
\addplot[only marks,mark=star,mark size=2pt,color=black] coordinates{(0,0)};
\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]
\addplot[solid,mark=asterisk,mark options={solid},color=blue] {x^2};
\addplot[solid,mark=asterisk,mark options={solid},color=red] {x^3};
\addplot[only marks,mark=star,mark size=2pt,color=black] coordinates{(0,0)};
%\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...
pgfplots
is too old).latexmk -pdf
FWIW.