TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I use the tikz.spy library in order to magnify a part of my pgfplots plot with the use of grids, there are both the original grid and the magnified grid in the magnified area. screenshot: .

a part of the code looks like this:

\begin{tikzpicture} [spy using outlines={circle, magnification=3, size=2cm, connect spies}]

\begin{axis}[grid=major,axis on top, ... ]

\addplot ...

    \spy[green!70!black,size=5cm] on (10.9,9.1) in node [right] at (3,6);


Is it possible to have only the magnified grid in the magnified area (e.g. to set the opacity of magnified area? The fill=white command seems to has no effect. I tried the same with the opacity property. spy using overlay doesn't help neither. Another way would be to have the grid only in the magnified area, but I have no idea how to do.

Does anyone has a solution?

share|improve this question
Really nice graph, by the way. Would you mind sharing how you filled the area between the curves? – Jake Mar 28 '11 at 17:07
look here: goo.gl/EYf90 -- i export the data (tables) for each line with matlab (fprintf) – kromuchi Mar 28 '11 at 17:27
up vote 10 down vote accepted

You have to supply the fill=white option to the "in-node":


\begin{tikzpicture} [spy using outlines={circle, magnification=3, size=2cm, connect spies}]
\begin{axis}[grid=major,axis on top,width=14cm]
\addplot +[mark=none] {0.1*x^2};

    \spy[green!70!black,size=5cm] on (10.9,8) in node [fill=white] at (6,7);


spy node with filled background

share|improve this answer
Wow, nice. I tried putting it every which place but that one! – Matthew Leingang Mar 28 '11 at 17:17
thanks a lot. that's what i've looked for. – kromuchi Mar 28 '11 at 17:24
could i give an image instead of \addplot? (e.g. \includegraphics instead of \addplot) – Eagle Nov 2 '11 at 15:55
@Eagle: Yes, you can. – Jake Nov 2 '11 at 20:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.