Add arrow and words on a magnified pic using TikZ spy

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite
2












I want to add some arrows and words on a magnifying pic. Add A, B, and C on the magnifying pic. Could anybody help me fix this problem? Thanksenter image description here



 beginfigure
begintikzpicture[scale=1,spy using outlines=circle, magnification=4,size=2.5cm, connect spies]
coordinate (center) at (0,0);
coordinate (A) at (2,1.5);
coordinate (B) at (6,1.5);
coordinate (C) at (2,1);
coordinate (D) at (6,1);
coordinate (E) at (2,0);
coordinate (F) at (6,0);
coordinate (G) at (2,-1);
coordinate (H) at (6,-1);
coordinate (I) at (2,-1.5);
coordinate (J) at (6,-1.5);
%Upper
foreach x / y / z in 3.9/1.5/K, 4.1/1.5/L, 3.9/1/M, 4.1/1/N,3.8/1.5/O, 3.8/1.3/P, 3.9/1.3/Q, 4.1/1.1/R, 4.2/1.1/S, 4.2/1.5/T
coordinate (z) at (x, y);
filldraw (K)--(M)--(N)--(L)--(K);
draw (O)--(P)--(Q);
draw (R)--(S)--(T);
%Lower
foreach x / y / z in 3.9/-1.5/K, 4.1/-1.5/L, 3.9/-1/M, 4.1/-1/N, 3.8/-1.5/O, 3.8/-1.3/P, 3.9/-1.3/Q, 4.1/-1.1/R, 4.2/-1.1/S, 4.2/-1.5/T
coordinate (z) at (x, y);
filldraw (K)--(M)--(N)--(L)--(K);
draw (O)--(P)--(Q);
draw (R)--(S)--(T);
%The left figure
draw [->] (-0.3,0.7) arc [start angle=150, end angle=30, radius=10pt];
draw (center) circle [radius=1.5cm];
draw (center) circle [radius=1cm];
foreach x / y in 0/30,10/40,20/50,30/60,40/70,50/80,60/90,70/100,80/110,90/120,100/130,110/140,120/150,130/160,140/170,150/180,160/190,170/200,180/210,190/220,200/230,210/240,220/250,230/260,240/270,250/280,260/290,270/300,280/310,290/320,300/330,310/340,320/350,330/360,340/10,350/20
draw (x:1) -- (y:1.5);
%The right figure
draw (A)--(B);
draw (C)--(D);
draw (G)--(H);
draw (I)--(J);
draw (C) cos (1.86,0.5) sin (E);
filldraw [pattern=north east lines] (E) cos (2.14,-0.5) sin(G) cos (1.86,-0.5) sin (E);
%draw (E) cos (1.86,-0.5) sin (G);
draw (F) cos (6.14,-0.5) sin(H);
filldraw [pattern=north east lines](D) cos (6.14,0.5) sin (F) cos (5.86,0.5) sin (D);
draw [style=dashed] (-2,0)--(6.5,0) (0,2)--(0,-2);
%located zoomed figure
spy [red] on (4,1.25) in node [spy] at (8,0);
endtikzpicture
endfigure






share|improve this question


























    up vote
    4
    down vote

    favorite
    2












    I want to add some arrows and words on a magnifying pic. Add A, B, and C on the magnifying pic. Could anybody help me fix this problem? Thanksenter image description here



     beginfigure
    begintikzpicture[scale=1,spy using outlines=circle, magnification=4,size=2.5cm, connect spies]
    coordinate (center) at (0,0);
    coordinate (A) at (2,1.5);
    coordinate (B) at (6,1.5);
    coordinate (C) at (2,1);
    coordinate (D) at (6,1);
    coordinate (E) at (2,0);
    coordinate (F) at (6,0);
    coordinate (G) at (2,-1);
    coordinate (H) at (6,-1);
    coordinate (I) at (2,-1.5);
    coordinate (J) at (6,-1.5);
    %Upper
    foreach x / y / z in 3.9/1.5/K, 4.1/1.5/L, 3.9/1/M, 4.1/1/N,3.8/1.5/O, 3.8/1.3/P, 3.9/1.3/Q, 4.1/1.1/R, 4.2/1.1/S, 4.2/1.5/T
    coordinate (z) at (x, y);
    filldraw (K)--(M)--(N)--(L)--(K);
    draw (O)--(P)--(Q);
    draw (R)--(S)--(T);
    %Lower
    foreach x / y / z in 3.9/-1.5/K, 4.1/-1.5/L, 3.9/-1/M, 4.1/-1/N, 3.8/-1.5/O, 3.8/-1.3/P, 3.9/-1.3/Q, 4.1/-1.1/R, 4.2/-1.1/S, 4.2/-1.5/T
    coordinate (z) at (x, y);
    filldraw (K)--(M)--(N)--(L)--(K);
    draw (O)--(P)--(Q);
    draw (R)--(S)--(T);
    %The left figure
    draw [->] (-0.3,0.7) arc [start angle=150, end angle=30, radius=10pt];
    draw (center) circle [radius=1.5cm];
    draw (center) circle [radius=1cm];
    foreach x / y in 0/30,10/40,20/50,30/60,40/70,50/80,60/90,70/100,80/110,90/120,100/130,110/140,120/150,130/160,140/170,150/180,160/190,170/200,180/210,190/220,200/230,210/240,220/250,230/260,240/270,250/280,260/290,270/300,280/310,290/320,300/330,310/340,320/350,330/360,340/10,350/20
    draw (x:1) -- (y:1.5);
    %The right figure
    draw (A)--(B);
    draw (C)--(D);
    draw (G)--(H);
    draw (I)--(J);
    draw (C) cos (1.86,0.5) sin (E);
    filldraw [pattern=north east lines] (E) cos (2.14,-0.5) sin(G) cos (1.86,-0.5) sin (E);
    %draw (E) cos (1.86,-0.5) sin (G);
    draw (F) cos (6.14,-0.5) sin(H);
    filldraw [pattern=north east lines](D) cos (6.14,0.5) sin (F) cos (5.86,0.5) sin (D);
    draw [style=dashed] (-2,0)--(6.5,0) (0,2)--(0,-2);
    %located zoomed figure
    spy [red] on (4,1.25) in node [spy] at (8,0);
    endtikzpicture
    endfigure






    share|improve this question
























      up vote
      4
      down vote

      favorite
      2









      up vote
      4
      down vote

      favorite
      2






      2





      I want to add some arrows and words on a magnifying pic. Add A, B, and C on the magnifying pic. Could anybody help me fix this problem? Thanksenter image description here



       beginfigure
      begintikzpicture[scale=1,spy using outlines=circle, magnification=4,size=2.5cm, connect spies]
      coordinate (center) at (0,0);
      coordinate (A) at (2,1.5);
      coordinate (B) at (6,1.5);
      coordinate (C) at (2,1);
      coordinate (D) at (6,1);
      coordinate (E) at (2,0);
      coordinate (F) at (6,0);
      coordinate (G) at (2,-1);
      coordinate (H) at (6,-1);
      coordinate (I) at (2,-1.5);
      coordinate (J) at (6,-1.5);
      %Upper
      foreach x / y / z in 3.9/1.5/K, 4.1/1.5/L, 3.9/1/M, 4.1/1/N,3.8/1.5/O, 3.8/1.3/P, 3.9/1.3/Q, 4.1/1.1/R, 4.2/1.1/S, 4.2/1.5/T
      coordinate (z) at (x, y);
      filldraw (K)--(M)--(N)--(L)--(K);
      draw (O)--(P)--(Q);
      draw (R)--(S)--(T);
      %Lower
      foreach x / y / z in 3.9/-1.5/K, 4.1/-1.5/L, 3.9/-1/M, 4.1/-1/N, 3.8/-1.5/O, 3.8/-1.3/P, 3.9/-1.3/Q, 4.1/-1.1/R, 4.2/-1.1/S, 4.2/-1.5/T
      coordinate (z) at (x, y);
      filldraw (K)--(M)--(N)--(L)--(K);
      draw (O)--(P)--(Q);
      draw (R)--(S)--(T);
      %The left figure
      draw [->] (-0.3,0.7) arc [start angle=150, end angle=30, radius=10pt];
      draw (center) circle [radius=1.5cm];
      draw (center) circle [radius=1cm];
      foreach x / y in 0/30,10/40,20/50,30/60,40/70,50/80,60/90,70/100,80/110,90/120,100/130,110/140,120/150,130/160,140/170,150/180,160/190,170/200,180/210,190/220,200/230,210/240,220/250,230/260,240/270,250/280,260/290,270/300,280/310,290/320,300/330,310/340,320/350,330/360,340/10,350/20
      draw (x:1) -- (y:1.5);
      %The right figure
      draw (A)--(B);
      draw (C)--(D);
      draw (G)--(H);
      draw (I)--(J);
      draw (C) cos (1.86,0.5) sin (E);
      filldraw [pattern=north east lines] (E) cos (2.14,-0.5) sin(G) cos (1.86,-0.5) sin (E);
      %draw (E) cos (1.86,-0.5) sin (G);
      draw (F) cos (6.14,-0.5) sin(H);
      filldraw [pattern=north east lines](D) cos (6.14,0.5) sin (F) cos (5.86,0.5) sin (D);
      draw [style=dashed] (-2,0)--(6.5,0) (0,2)--(0,-2);
      %located zoomed figure
      spy [red] on (4,1.25) in node [spy] at (8,0);
      endtikzpicture
      endfigure






      share|improve this question














      I want to add some arrows and words on a magnifying pic. Add A, B, and C on the magnifying pic. Could anybody help me fix this problem? Thanksenter image description here



       beginfigure
      begintikzpicture[scale=1,spy using outlines=circle, magnification=4,size=2.5cm, connect spies]
      coordinate (center) at (0,0);
      coordinate (A) at (2,1.5);
      coordinate (B) at (6,1.5);
      coordinate (C) at (2,1);
      coordinate (D) at (6,1);
      coordinate (E) at (2,0);
      coordinate (F) at (6,0);
      coordinate (G) at (2,-1);
      coordinate (H) at (6,-1);
      coordinate (I) at (2,-1.5);
      coordinate (J) at (6,-1.5);
      %Upper
      foreach x / y / z in 3.9/1.5/K, 4.1/1.5/L, 3.9/1/M, 4.1/1/N,3.8/1.5/O, 3.8/1.3/P, 3.9/1.3/Q, 4.1/1.1/R, 4.2/1.1/S, 4.2/1.5/T
      coordinate (z) at (x, y);
      filldraw (K)--(M)--(N)--(L)--(K);
      draw (O)--(P)--(Q);
      draw (R)--(S)--(T);
      %Lower
      foreach x / y / z in 3.9/-1.5/K, 4.1/-1.5/L, 3.9/-1/M, 4.1/-1/N, 3.8/-1.5/O, 3.8/-1.3/P, 3.9/-1.3/Q, 4.1/-1.1/R, 4.2/-1.1/S, 4.2/-1.5/T
      coordinate (z) at (x, y);
      filldraw (K)--(M)--(N)--(L)--(K);
      draw (O)--(P)--(Q);
      draw (R)--(S)--(T);
      %The left figure
      draw [->] (-0.3,0.7) arc [start angle=150, end angle=30, radius=10pt];
      draw (center) circle [radius=1.5cm];
      draw (center) circle [radius=1cm];
      foreach x / y in 0/30,10/40,20/50,30/60,40/70,50/80,60/90,70/100,80/110,90/120,100/130,110/140,120/150,130/160,140/170,150/180,160/190,170/200,180/210,190/220,200/230,210/240,220/250,230/260,240/270,250/280,260/290,270/300,280/310,290/320,300/330,310/340,320/350,330/360,340/10,350/20
      draw (x:1) -- (y:1.5);
      %The right figure
      draw (A)--(B);
      draw (C)--(D);
      draw (G)--(H);
      draw (I)--(J);
      draw (C) cos (1.86,0.5) sin (E);
      filldraw [pattern=north east lines] (E) cos (2.14,-0.5) sin(G) cos (1.86,-0.5) sin (E);
      %draw (E) cos (1.86,-0.5) sin (G);
      draw (F) cos (6.14,-0.5) sin(H);
      filldraw [pattern=north east lines](D) cos (6.14,0.5) sin (F) cos (5.86,0.5) sin (D);
      draw [style=dashed] (-2,0)--(6.5,0) (0,2)--(0,-2);
      %located zoomed figure
      spy [red] on (4,1.25) in node [spy] at (8,0);
      endtikzpicture
      endfigure








      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 11 at 19:42









      Milo

      5,42821345




      5,42821345










      asked Aug 11 at 18:51









      Yuchi

      333




      333




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          Here is one way to do it. To make sure the arrows stay on top of the spied area I've used the backgrounds library. Made arrow B green to demonstrate it is indeed on top.



          enter image description here



          documentclass[tikz,margin=0.5cm]standalone
          usetikzlibrarypatterns,spy,backgrounds
          pgfdeclarelayerforeground
          pgfsetlayersbackground,main,foreground

          begindocument

          begintikzpicture[scale=1,spy using outlines=circle, magnification=4,size=2.5cm, connect spies]
          coordinate (center) at (0,0);
          coordinate (A) at (2,1.5);
          coordinate (B) at (6,1.5);
          coordinate (C) at (2,1);
          coordinate (D) at (6,1);
          coordinate (E) at (2,0);
          coordinate (F) at (6,0);
          coordinate (G) at (2,-1);
          coordinate (H) at (6,-1);
          coordinate (I) at (2,-1.5);
          coordinate (J) at (6,-1.5);
          %Upper
          foreach x / y / z in 3.9/1.5/K, 4.1/1.5/L, 3.9/1/M, 4.1/1/N,3.8/1.5/O, 3.8/1.3/P, 3.9/1.3/Q, 4.1/1.1/R, 4.2/1.1/S, 4.2/1.5/T
          coordinate (z) at (x, y);
          filldraw (K)--(M)--(N)--(L)--(K);
          draw (O)--(P)--(Q);
          draw (R)--(S)--(T);
          %Lower
          foreach x / y / z in 3.9/-1.5/K, 4.1/-1.5/L, 3.9/-1/M, 4.1/-1/N, 3.8/-1.5/O, 3.8/-1.3/P, 3.9/-1.3/Q, 4.1/-1.1/R, 4.2/-1.1/S, 4.2/-1.5/T
          coordinate (z) at (x, y);
          filldraw (K)--(M)--(N)--(L)--(K);
          draw (O)--(P)--(Q);
          draw (R)--(S)--(T);
          %The left figure
          draw [->] (-0.3,0.7) arc [start angle=150, end angle=30, radius=10pt];
          draw (center) circle [radius=1.5cm];
          draw (center) circle [radius=1cm];
          foreach x / y in 0/30,10/40,20/50,30/60,40/70,50/80,60/90,70/100,80/110,90/120,100/130,110/140,120/150,130/160,140/170,150/180,160/190,170/200,180/210,190/220,200/230,210/240,220/250,230/260,240/270,250/280,260/290,270/300,280/310,290/320,300/330,310/340,320/350,330/360,340/10,350/20
          draw (x:1) -- (y:1.5);
          %The right figure
          draw (A)--(B);
          draw (C)--(D);
          draw (G)--(H);
          draw (I)--(J);
          draw (C) cos (1.86,0.5) sin (E);
          filldraw [pattern=north east lines] (E) cos (2.14,-0.5) sin(G) cos (1.86,-0.5) sin (E);
          %draw (E) cos (1.86,-0.5) sin (G);
          draw (F) cos (6.14,-0.5) sin(H);
          filldraw [pattern=north east lines](D) cos (6.14,0.5) sin (F) cos (5.86,0.5) sin (D);
          draw [style=dashed] (-2,0)--(6.5,0) (0,2)--(0,-2);
          %located zoomed figure
          coordinate (zoomLoc) at (8,0);
          spy [red] on (4,1.25) in node at (zoomLoc);

          beginpgfonlayerforeground
          draw [thick,<-] ([xshift=0.6cm,yshift=-0.3cm]zoomLoc)--++(-60:0.8cm)--++(0:0.7cm) node [right] C;
          draw [thick,<-] ([xshift=-0.6cm,yshift=0.5cm]zoomLoc)--++(70:1.2cm)--++(0:1.8cm) node [right] A;
          draw [green,thick,<-] ([xshift=0.3cm]zoomLoc)--++(70:1.2cm)--++(0:0.9cm) node [text=black,right] B;
          endpgfonlayerforeground

          endtikzpicture
          enddocument





          share|improve this answer






















          • Thanks for your help. This is my first time I know pgflayer. I am learning pgflayer from the pgfmannual. Thanks again.
            – Yuchi
            Aug 12 at 6:48

















          up vote
          4
          down vote













          Here is an answer that is based on this older answer and conceptionally very similar to Milo's nice answer. The slight advantage is that this answer comes with a local coordinate system for the zoomed part, which may make it more straightforward to place the annotations. In particular, if you ever decide to move the zoomed in stuff around and/or change the zoom factor, the annotations will adjust. Milos approach is also fine with moving the zoomed stuff around. I also use outlined arrows for the sake of a better visibility.



          documentclass[tikz,margin=0.5cm]standalone
          usetikzlibrarypatterns,spy,backgrounds,calc,arrows.meta
          pgfdeclarelayerforeground
          pgfsetlayersbackground,main,foreground

          begindocument
          tikzsetevery spy on node/.append style=alias=zoom
          begintikzpicture[remember picture,scale=1,spy using outlines=circle, magnification=4,size=2.5cm, connect spies]
          coordinate (center) at (0,0);
          coordinate (A) at (2,1.5);
          coordinate (B) at (6,1.5);
          coordinate (C) at (2,1);
          coordinate (D) at (6,1);
          coordinate (E) at (2,0);
          coordinate (F) at (6,0);
          coordinate (G) at (2,-1);
          coordinate (H) at (6,-1);
          coordinate (I) at (2,-1.5);
          coordinate (J) at (6,-1.5);
          %Upper
          foreach x / y / z in 3.9/1.5/K, 4.1/1.5/L, 3.9/1/M, 4.1/1/N,3.8/1.5/O, 3.8/1.3/P, 3.9/1.3/Q, 4.1/1.1/R, 4.2/1.1/S, 4.2/1.5/T
          coordinate (z) at (x, y);
          filldraw (K)--(M)--(N)--(L)--(K);
          draw (O)--(P)--(Q);
          draw (R)--(S)--(T);
          %Lower
          foreach x / y / z in 3.9/-1.5/K, 4.1/-1.5/L, 3.9/-1/M, 4.1/-1/N, 3.8/-1.5/O, 3.8/-1.3/P, 3.9/-1.3/Q, 4.1/-1.1/R, 4.2/-1.1/S, 4.2/-1.5/T
          coordinate (z) at (x, y);
          filldraw (K)--(M)--(N)--(L)--(K);
          draw (O)--(P)--(Q);
          draw (R)--(S)--(T);
          %The left figure
          draw [->] (-0.3,0.7) arc [start angle=150, end angle=30, radius=10pt];
          draw (center) circle [radius=1.5cm];
          draw (center) circle [radius=1cm];
          foreach x / y in 0/30,10/40,20/50,30/60,40/70,50/80,60/90,70/100,80/110,90/120,100/130,110/140,120/150,130/160,140/170,150/180,160/190,170/200,180/210,190/220,200/230,210/240,220/250,230/260,240/270,250/280,260/290,270/300,280/310,290/320,300/330,310/340,320/350,330/360,340/10,350/20
          draw (x:1) -- (y:1.5);
          %The right figure
          draw (A)--(B);
          draw (C)--(D);
          draw (G)--(H);
          draw (I)--(J);
          draw (C) cos (1.86,0.5) sin (E);
          filldraw [pattern=north east lines] (E) cos (2.14,-0.5) sin(G) cos (1.86,-0.5) sin (E);
          %draw (E) cos (1.86,-0.5) sin (G);
          draw (F) cos (6.14,-0.5) sin(H);
          filldraw [pattern=north east lines](D) cos (6.14,0.5) sin (F) cos (5.86,0.5) sin (D);
          draw [style=dashed] (-2,0)--(6.5,0) (0,2)--(0,-2);
          %located zoomed figure
          coordinate (zoomLoc) at (8,0);
          spy [red,on background layer,
          spy connection path=draw (tikzspyonnode) -- (tikzspyinnode);
          beginpgfonlayerforeground % https://tex.stackexchange.com/a/426272/121799
          beginscope[shift=(tikzspyinnode.south west),x=($(tikzspyinnode.south east)-(tikzspyinnode.south west)$),
          y=($(tikzspyinnode.north west)-(tikzspyinnode.south west)$)]
          draw[Latex[open]-,black,double=white] (0.15,0.75) -- ++ (0.5,0.5) -- ++ (0.5,0)
          node[right,minimum size=0pt]A;
          draw[Latex[open,fill=white]-,black,double=white] (0.5,0.5) --
          ++ (0.35,0.35) -- ++ (0.35,0) node[right,minimum size=0pt]B;
          draw[Latex[open,fill=white]-,black,double=white] (0.8,0.4) --
          ++ (0.25,-0.25) -- ++ (0.15,0) node[right,minimum size=0pt]C;
          endscope
          endpgfonlayer] on (4,1.25) in node at (zoomLoc);
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "85"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f445681%2fadd-arrow-and-words-on-a-magnified-pic-using-tikz-spy%23new-answer', 'question_page');

            );

            Post as a guest






























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            3
            down vote



            accepted










            Here is one way to do it. To make sure the arrows stay on top of the spied area I've used the backgrounds library. Made arrow B green to demonstrate it is indeed on top.



            enter image description here



            documentclass[tikz,margin=0.5cm]standalone
            usetikzlibrarypatterns,spy,backgrounds
            pgfdeclarelayerforeground
            pgfsetlayersbackground,main,foreground

            begindocument

            begintikzpicture[scale=1,spy using outlines=circle, magnification=4,size=2.5cm, connect spies]
            coordinate (center) at (0,0);
            coordinate (A) at (2,1.5);
            coordinate (B) at (6,1.5);
            coordinate (C) at (2,1);
            coordinate (D) at (6,1);
            coordinate (E) at (2,0);
            coordinate (F) at (6,0);
            coordinate (G) at (2,-1);
            coordinate (H) at (6,-1);
            coordinate (I) at (2,-1.5);
            coordinate (J) at (6,-1.5);
            %Upper
            foreach x / y / z in 3.9/1.5/K, 4.1/1.5/L, 3.9/1/M, 4.1/1/N,3.8/1.5/O, 3.8/1.3/P, 3.9/1.3/Q, 4.1/1.1/R, 4.2/1.1/S, 4.2/1.5/T
            coordinate (z) at (x, y);
            filldraw (K)--(M)--(N)--(L)--(K);
            draw (O)--(P)--(Q);
            draw (R)--(S)--(T);
            %Lower
            foreach x / y / z in 3.9/-1.5/K, 4.1/-1.5/L, 3.9/-1/M, 4.1/-1/N, 3.8/-1.5/O, 3.8/-1.3/P, 3.9/-1.3/Q, 4.1/-1.1/R, 4.2/-1.1/S, 4.2/-1.5/T
            coordinate (z) at (x, y);
            filldraw (K)--(M)--(N)--(L)--(K);
            draw (O)--(P)--(Q);
            draw (R)--(S)--(T);
            %The left figure
            draw [->] (-0.3,0.7) arc [start angle=150, end angle=30, radius=10pt];
            draw (center) circle [radius=1.5cm];
            draw (center) circle [radius=1cm];
            foreach x / y in 0/30,10/40,20/50,30/60,40/70,50/80,60/90,70/100,80/110,90/120,100/130,110/140,120/150,130/160,140/170,150/180,160/190,170/200,180/210,190/220,200/230,210/240,220/250,230/260,240/270,250/280,260/290,270/300,280/310,290/320,300/330,310/340,320/350,330/360,340/10,350/20
            draw (x:1) -- (y:1.5);
            %The right figure
            draw (A)--(B);
            draw (C)--(D);
            draw (G)--(H);
            draw (I)--(J);
            draw (C) cos (1.86,0.5) sin (E);
            filldraw [pattern=north east lines] (E) cos (2.14,-0.5) sin(G) cos (1.86,-0.5) sin (E);
            %draw (E) cos (1.86,-0.5) sin (G);
            draw (F) cos (6.14,-0.5) sin(H);
            filldraw [pattern=north east lines](D) cos (6.14,0.5) sin (F) cos (5.86,0.5) sin (D);
            draw [style=dashed] (-2,0)--(6.5,0) (0,2)--(0,-2);
            %located zoomed figure
            coordinate (zoomLoc) at (8,0);
            spy [red] on (4,1.25) in node at (zoomLoc);

            beginpgfonlayerforeground
            draw [thick,<-] ([xshift=0.6cm,yshift=-0.3cm]zoomLoc)--++(-60:0.8cm)--++(0:0.7cm) node [right] C;
            draw [thick,<-] ([xshift=-0.6cm,yshift=0.5cm]zoomLoc)--++(70:1.2cm)--++(0:1.8cm) node [right] A;
            draw [green,thick,<-] ([xshift=0.3cm]zoomLoc)--++(70:1.2cm)--++(0:0.9cm) node [text=black,right] B;
            endpgfonlayerforeground

            endtikzpicture
            enddocument





            share|improve this answer






















            • Thanks for your help. This is my first time I know pgflayer. I am learning pgflayer from the pgfmannual. Thanks again.
              – Yuchi
              Aug 12 at 6:48














            up vote
            3
            down vote



            accepted










            Here is one way to do it. To make sure the arrows stay on top of the spied area I've used the backgrounds library. Made arrow B green to demonstrate it is indeed on top.



            enter image description here



            documentclass[tikz,margin=0.5cm]standalone
            usetikzlibrarypatterns,spy,backgrounds
            pgfdeclarelayerforeground
            pgfsetlayersbackground,main,foreground

            begindocument

            begintikzpicture[scale=1,spy using outlines=circle, magnification=4,size=2.5cm, connect spies]
            coordinate (center) at (0,0);
            coordinate (A) at (2,1.5);
            coordinate (B) at (6,1.5);
            coordinate (C) at (2,1);
            coordinate (D) at (6,1);
            coordinate (E) at (2,0);
            coordinate (F) at (6,0);
            coordinate (G) at (2,-1);
            coordinate (H) at (6,-1);
            coordinate (I) at (2,-1.5);
            coordinate (J) at (6,-1.5);
            %Upper
            foreach x / y / z in 3.9/1.5/K, 4.1/1.5/L, 3.9/1/M, 4.1/1/N,3.8/1.5/O, 3.8/1.3/P, 3.9/1.3/Q, 4.1/1.1/R, 4.2/1.1/S, 4.2/1.5/T
            coordinate (z) at (x, y);
            filldraw (K)--(M)--(N)--(L)--(K);
            draw (O)--(P)--(Q);
            draw (R)--(S)--(T);
            %Lower
            foreach x / y / z in 3.9/-1.5/K, 4.1/-1.5/L, 3.9/-1/M, 4.1/-1/N, 3.8/-1.5/O, 3.8/-1.3/P, 3.9/-1.3/Q, 4.1/-1.1/R, 4.2/-1.1/S, 4.2/-1.5/T
            coordinate (z) at (x, y);
            filldraw (K)--(M)--(N)--(L)--(K);
            draw (O)--(P)--(Q);
            draw (R)--(S)--(T);
            %The left figure
            draw [->] (-0.3,0.7) arc [start angle=150, end angle=30, radius=10pt];
            draw (center) circle [radius=1.5cm];
            draw (center) circle [radius=1cm];
            foreach x / y in 0/30,10/40,20/50,30/60,40/70,50/80,60/90,70/100,80/110,90/120,100/130,110/140,120/150,130/160,140/170,150/180,160/190,170/200,180/210,190/220,200/230,210/240,220/250,230/260,240/270,250/280,260/290,270/300,280/310,290/320,300/330,310/340,320/350,330/360,340/10,350/20
            draw (x:1) -- (y:1.5);
            %The right figure
            draw (A)--(B);
            draw (C)--(D);
            draw (G)--(H);
            draw (I)--(J);
            draw (C) cos (1.86,0.5) sin (E);
            filldraw [pattern=north east lines] (E) cos (2.14,-0.5) sin(G) cos (1.86,-0.5) sin (E);
            %draw (E) cos (1.86,-0.5) sin (G);
            draw (F) cos (6.14,-0.5) sin(H);
            filldraw [pattern=north east lines](D) cos (6.14,0.5) sin (F) cos (5.86,0.5) sin (D);
            draw [style=dashed] (-2,0)--(6.5,0) (0,2)--(0,-2);
            %located zoomed figure
            coordinate (zoomLoc) at (8,0);
            spy [red] on (4,1.25) in node at (zoomLoc);

            beginpgfonlayerforeground
            draw [thick,<-] ([xshift=0.6cm,yshift=-0.3cm]zoomLoc)--++(-60:0.8cm)--++(0:0.7cm) node [right] C;
            draw [thick,<-] ([xshift=-0.6cm,yshift=0.5cm]zoomLoc)--++(70:1.2cm)--++(0:1.8cm) node [right] A;
            draw [green,thick,<-] ([xshift=0.3cm]zoomLoc)--++(70:1.2cm)--++(0:0.9cm) node [text=black,right] B;
            endpgfonlayerforeground

            endtikzpicture
            enddocument





            share|improve this answer






















            • Thanks for your help. This is my first time I know pgflayer. I am learning pgflayer from the pgfmannual. Thanks again.
              – Yuchi
              Aug 12 at 6:48












            up vote
            3
            down vote



            accepted







            up vote
            3
            down vote



            accepted






            Here is one way to do it. To make sure the arrows stay on top of the spied area I've used the backgrounds library. Made arrow B green to demonstrate it is indeed on top.



            enter image description here



            documentclass[tikz,margin=0.5cm]standalone
            usetikzlibrarypatterns,spy,backgrounds
            pgfdeclarelayerforeground
            pgfsetlayersbackground,main,foreground

            begindocument

            begintikzpicture[scale=1,spy using outlines=circle, magnification=4,size=2.5cm, connect spies]
            coordinate (center) at (0,0);
            coordinate (A) at (2,1.5);
            coordinate (B) at (6,1.5);
            coordinate (C) at (2,1);
            coordinate (D) at (6,1);
            coordinate (E) at (2,0);
            coordinate (F) at (6,0);
            coordinate (G) at (2,-1);
            coordinate (H) at (6,-1);
            coordinate (I) at (2,-1.5);
            coordinate (J) at (6,-1.5);
            %Upper
            foreach x / y / z in 3.9/1.5/K, 4.1/1.5/L, 3.9/1/M, 4.1/1/N,3.8/1.5/O, 3.8/1.3/P, 3.9/1.3/Q, 4.1/1.1/R, 4.2/1.1/S, 4.2/1.5/T
            coordinate (z) at (x, y);
            filldraw (K)--(M)--(N)--(L)--(K);
            draw (O)--(P)--(Q);
            draw (R)--(S)--(T);
            %Lower
            foreach x / y / z in 3.9/-1.5/K, 4.1/-1.5/L, 3.9/-1/M, 4.1/-1/N, 3.8/-1.5/O, 3.8/-1.3/P, 3.9/-1.3/Q, 4.1/-1.1/R, 4.2/-1.1/S, 4.2/-1.5/T
            coordinate (z) at (x, y);
            filldraw (K)--(M)--(N)--(L)--(K);
            draw (O)--(P)--(Q);
            draw (R)--(S)--(T);
            %The left figure
            draw [->] (-0.3,0.7) arc [start angle=150, end angle=30, radius=10pt];
            draw (center) circle [radius=1.5cm];
            draw (center) circle [radius=1cm];
            foreach x / y in 0/30,10/40,20/50,30/60,40/70,50/80,60/90,70/100,80/110,90/120,100/130,110/140,120/150,130/160,140/170,150/180,160/190,170/200,180/210,190/220,200/230,210/240,220/250,230/260,240/270,250/280,260/290,270/300,280/310,290/320,300/330,310/340,320/350,330/360,340/10,350/20
            draw (x:1) -- (y:1.5);
            %The right figure
            draw (A)--(B);
            draw (C)--(D);
            draw (G)--(H);
            draw (I)--(J);
            draw (C) cos (1.86,0.5) sin (E);
            filldraw [pattern=north east lines] (E) cos (2.14,-0.5) sin(G) cos (1.86,-0.5) sin (E);
            %draw (E) cos (1.86,-0.5) sin (G);
            draw (F) cos (6.14,-0.5) sin(H);
            filldraw [pattern=north east lines](D) cos (6.14,0.5) sin (F) cos (5.86,0.5) sin (D);
            draw [style=dashed] (-2,0)--(6.5,0) (0,2)--(0,-2);
            %located zoomed figure
            coordinate (zoomLoc) at (8,0);
            spy [red] on (4,1.25) in node at (zoomLoc);

            beginpgfonlayerforeground
            draw [thick,<-] ([xshift=0.6cm,yshift=-0.3cm]zoomLoc)--++(-60:0.8cm)--++(0:0.7cm) node [right] C;
            draw [thick,<-] ([xshift=-0.6cm,yshift=0.5cm]zoomLoc)--++(70:1.2cm)--++(0:1.8cm) node [right] A;
            draw [green,thick,<-] ([xshift=0.3cm]zoomLoc)--++(70:1.2cm)--++(0:0.9cm) node [text=black,right] B;
            endpgfonlayerforeground

            endtikzpicture
            enddocument





            share|improve this answer














            Here is one way to do it. To make sure the arrows stay on top of the spied area I've used the backgrounds library. Made arrow B green to demonstrate it is indeed on top.



            enter image description here



            documentclass[tikz,margin=0.5cm]standalone
            usetikzlibrarypatterns,spy,backgrounds
            pgfdeclarelayerforeground
            pgfsetlayersbackground,main,foreground

            begindocument

            begintikzpicture[scale=1,spy using outlines=circle, magnification=4,size=2.5cm, connect spies]
            coordinate (center) at (0,0);
            coordinate (A) at (2,1.5);
            coordinate (B) at (6,1.5);
            coordinate (C) at (2,1);
            coordinate (D) at (6,1);
            coordinate (E) at (2,0);
            coordinate (F) at (6,0);
            coordinate (G) at (2,-1);
            coordinate (H) at (6,-1);
            coordinate (I) at (2,-1.5);
            coordinate (J) at (6,-1.5);
            %Upper
            foreach x / y / z in 3.9/1.5/K, 4.1/1.5/L, 3.9/1/M, 4.1/1/N,3.8/1.5/O, 3.8/1.3/P, 3.9/1.3/Q, 4.1/1.1/R, 4.2/1.1/S, 4.2/1.5/T
            coordinate (z) at (x, y);
            filldraw (K)--(M)--(N)--(L)--(K);
            draw (O)--(P)--(Q);
            draw (R)--(S)--(T);
            %Lower
            foreach x / y / z in 3.9/-1.5/K, 4.1/-1.5/L, 3.9/-1/M, 4.1/-1/N, 3.8/-1.5/O, 3.8/-1.3/P, 3.9/-1.3/Q, 4.1/-1.1/R, 4.2/-1.1/S, 4.2/-1.5/T
            coordinate (z) at (x, y);
            filldraw (K)--(M)--(N)--(L)--(K);
            draw (O)--(P)--(Q);
            draw (R)--(S)--(T);
            %The left figure
            draw [->] (-0.3,0.7) arc [start angle=150, end angle=30, radius=10pt];
            draw (center) circle [radius=1.5cm];
            draw (center) circle [radius=1cm];
            foreach x / y in 0/30,10/40,20/50,30/60,40/70,50/80,60/90,70/100,80/110,90/120,100/130,110/140,120/150,130/160,140/170,150/180,160/190,170/200,180/210,190/220,200/230,210/240,220/250,230/260,240/270,250/280,260/290,270/300,280/310,290/320,300/330,310/340,320/350,330/360,340/10,350/20
            draw (x:1) -- (y:1.5);
            %The right figure
            draw (A)--(B);
            draw (C)--(D);
            draw (G)--(H);
            draw (I)--(J);
            draw (C) cos (1.86,0.5) sin (E);
            filldraw [pattern=north east lines] (E) cos (2.14,-0.5) sin(G) cos (1.86,-0.5) sin (E);
            %draw (E) cos (1.86,-0.5) sin (G);
            draw (F) cos (6.14,-0.5) sin(H);
            filldraw [pattern=north east lines](D) cos (6.14,0.5) sin (F) cos (5.86,0.5) sin (D);
            draw [style=dashed] (-2,0)--(6.5,0) (0,2)--(0,-2);
            %located zoomed figure
            coordinate (zoomLoc) at (8,0);
            spy [red] on (4,1.25) in node at (zoomLoc);

            beginpgfonlayerforeground
            draw [thick,<-] ([xshift=0.6cm,yshift=-0.3cm]zoomLoc)--++(-60:0.8cm)--++(0:0.7cm) node [right] C;
            draw [thick,<-] ([xshift=-0.6cm,yshift=0.5cm]zoomLoc)--++(70:1.2cm)--++(0:1.8cm) node [right] A;
            draw [green,thick,<-] ([xshift=0.3cm]zoomLoc)--++(70:1.2cm)--++(0:0.9cm) node [text=black,right] B;
            endpgfonlayerforeground

            endtikzpicture
            enddocument






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Aug 11 at 19:37

























            answered Aug 11 at 19:30









            Milo

            5,42821345




            5,42821345











            • Thanks for your help. This is my first time I know pgflayer. I am learning pgflayer from the pgfmannual. Thanks again.
              – Yuchi
              Aug 12 at 6:48
















            • Thanks for your help. This is my first time I know pgflayer. I am learning pgflayer from the pgfmannual. Thanks again.
              – Yuchi
              Aug 12 at 6:48















            Thanks for your help. This is my first time I know pgflayer. I am learning pgflayer from the pgfmannual. Thanks again.
            – Yuchi
            Aug 12 at 6:48




            Thanks for your help. This is my first time I know pgflayer. I am learning pgflayer from the pgfmannual. Thanks again.
            – Yuchi
            Aug 12 at 6:48










            up vote
            4
            down vote













            Here is an answer that is based on this older answer and conceptionally very similar to Milo's nice answer. The slight advantage is that this answer comes with a local coordinate system for the zoomed part, which may make it more straightforward to place the annotations. In particular, if you ever decide to move the zoomed in stuff around and/or change the zoom factor, the annotations will adjust. Milos approach is also fine with moving the zoomed stuff around. I also use outlined arrows for the sake of a better visibility.



            documentclass[tikz,margin=0.5cm]standalone
            usetikzlibrarypatterns,spy,backgrounds,calc,arrows.meta
            pgfdeclarelayerforeground
            pgfsetlayersbackground,main,foreground

            begindocument
            tikzsetevery spy on node/.append style=alias=zoom
            begintikzpicture[remember picture,scale=1,spy using outlines=circle, magnification=4,size=2.5cm, connect spies]
            coordinate (center) at (0,0);
            coordinate (A) at (2,1.5);
            coordinate (B) at (6,1.5);
            coordinate (C) at (2,1);
            coordinate (D) at (6,1);
            coordinate (E) at (2,0);
            coordinate (F) at (6,0);
            coordinate (G) at (2,-1);
            coordinate (H) at (6,-1);
            coordinate (I) at (2,-1.5);
            coordinate (J) at (6,-1.5);
            %Upper
            foreach x / y / z in 3.9/1.5/K, 4.1/1.5/L, 3.9/1/M, 4.1/1/N,3.8/1.5/O, 3.8/1.3/P, 3.9/1.3/Q, 4.1/1.1/R, 4.2/1.1/S, 4.2/1.5/T
            coordinate (z) at (x, y);
            filldraw (K)--(M)--(N)--(L)--(K);
            draw (O)--(P)--(Q);
            draw (R)--(S)--(T);
            %Lower
            foreach x / y / z in 3.9/-1.5/K, 4.1/-1.5/L, 3.9/-1/M, 4.1/-1/N, 3.8/-1.5/O, 3.8/-1.3/P, 3.9/-1.3/Q, 4.1/-1.1/R, 4.2/-1.1/S, 4.2/-1.5/T
            coordinate (z) at (x, y);
            filldraw (K)--(M)--(N)--(L)--(K);
            draw (O)--(P)--(Q);
            draw (R)--(S)--(T);
            %The left figure
            draw [->] (-0.3,0.7) arc [start angle=150, end angle=30, radius=10pt];
            draw (center) circle [radius=1.5cm];
            draw (center) circle [radius=1cm];
            foreach x / y in 0/30,10/40,20/50,30/60,40/70,50/80,60/90,70/100,80/110,90/120,100/130,110/140,120/150,130/160,140/170,150/180,160/190,170/200,180/210,190/220,200/230,210/240,220/250,230/260,240/270,250/280,260/290,270/300,280/310,290/320,300/330,310/340,320/350,330/360,340/10,350/20
            draw (x:1) -- (y:1.5);
            %The right figure
            draw (A)--(B);
            draw (C)--(D);
            draw (G)--(H);
            draw (I)--(J);
            draw (C) cos (1.86,0.5) sin (E);
            filldraw [pattern=north east lines] (E) cos (2.14,-0.5) sin(G) cos (1.86,-0.5) sin (E);
            %draw (E) cos (1.86,-0.5) sin (G);
            draw (F) cos (6.14,-0.5) sin(H);
            filldraw [pattern=north east lines](D) cos (6.14,0.5) sin (F) cos (5.86,0.5) sin (D);
            draw [style=dashed] (-2,0)--(6.5,0) (0,2)--(0,-2);
            %located zoomed figure
            coordinate (zoomLoc) at (8,0);
            spy [red,on background layer,
            spy connection path=draw (tikzspyonnode) -- (tikzspyinnode);
            beginpgfonlayerforeground % https://tex.stackexchange.com/a/426272/121799
            beginscope[shift=(tikzspyinnode.south west),x=($(tikzspyinnode.south east)-(tikzspyinnode.south west)$),
            y=($(tikzspyinnode.north west)-(tikzspyinnode.south west)$)]
            draw[Latex[open]-,black,double=white] (0.15,0.75) -- ++ (0.5,0.5) -- ++ (0.5,0)
            node[right,minimum size=0pt]A;
            draw[Latex[open,fill=white]-,black,double=white] (0.5,0.5) --
            ++ (0.35,0.35) -- ++ (0.35,0) node[right,minimum size=0pt]B;
            draw[Latex[open,fill=white]-,black,double=white] (0.8,0.4) --
            ++ (0.25,-0.25) -- ++ (0.15,0) node[right,minimum size=0pt]C;
            endscope
            endpgfonlayer] on (4,1.25) in node at (zoomLoc);
            endtikzpicture
            enddocument


            enter image description here






            share|improve this answer
























              up vote
              4
              down vote













              Here is an answer that is based on this older answer and conceptionally very similar to Milo's nice answer. The slight advantage is that this answer comes with a local coordinate system for the zoomed part, which may make it more straightforward to place the annotations. In particular, if you ever decide to move the zoomed in stuff around and/or change the zoom factor, the annotations will adjust. Milos approach is also fine with moving the zoomed stuff around. I also use outlined arrows for the sake of a better visibility.



              documentclass[tikz,margin=0.5cm]standalone
              usetikzlibrarypatterns,spy,backgrounds,calc,arrows.meta
              pgfdeclarelayerforeground
              pgfsetlayersbackground,main,foreground

              begindocument
              tikzsetevery spy on node/.append style=alias=zoom
              begintikzpicture[remember picture,scale=1,spy using outlines=circle, magnification=4,size=2.5cm, connect spies]
              coordinate (center) at (0,0);
              coordinate (A) at (2,1.5);
              coordinate (B) at (6,1.5);
              coordinate (C) at (2,1);
              coordinate (D) at (6,1);
              coordinate (E) at (2,0);
              coordinate (F) at (6,0);
              coordinate (G) at (2,-1);
              coordinate (H) at (6,-1);
              coordinate (I) at (2,-1.5);
              coordinate (J) at (6,-1.5);
              %Upper
              foreach x / y / z in 3.9/1.5/K, 4.1/1.5/L, 3.9/1/M, 4.1/1/N,3.8/1.5/O, 3.8/1.3/P, 3.9/1.3/Q, 4.1/1.1/R, 4.2/1.1/S, 4.2/1.5/T
              coordinate (z) at (x, y);
              filldraw (K)--(M)--(N)--(L)--(K);
              draw (O)--(P)--(Q);
              draw (R)--(S)--(T);
              %Lower
              foreach x / y / z in 3.9/-1.5/K, 4.1/-1.5/L, 3.9/-1/M, 4.1/-1/N, 3.8/-1.5/O, 3.8/-1.3/P, 3.9/-1.3/Q, 4.1/-1.1/R, 4.2/-1.1/S, 4.2/-1.5/T
              coordinate (z) at (x, y);
              filldraw (K)--(M)--(N)--(L)--(K);
              draw (O)--(P)--(Q);
              draw (R)--(S)--(T);
              %The left figure
              draw [->] (-0.3,0.7) arc [start angle=150, end angle=30, radius=10pt];
              draw (center) circle [radius=1.5cm];
              draw (center) circle [radius=1cm];
              foreach x / y in 0/30,10/40,20/50,30/60,40/70,50/80,60/90,70/100,80/110,90/120,100/130,110/140,120/150,130/160,140/170,150/180,160/190,170/200,180/210,190/220,200/230,210/240,220/250,230/260,240/270,250/280,260/290,270/300,280/310,290/320,300/330,310/340,320/350,330/360,340/10,350/20
              draw (x:1) -- (y:1.5);
              %The right figure
              draw (A)--(B);
              draw (C)--(D);
              draw (G)--(H);
              draw (I)--(J);
              draw (C) cos (1.86,0.5) sin (E);
              filldraw [pattern=north east lines] (E) cos (2.14,-0.5) sin(G) cos (1.86,-0.5) sin (E);
              %draw (E) cos (1.86,-0.5) sin (G);
              draw (F) cos (6.14,-0.5) sin(H);
              filldraw [pattern=north east lines](D) cos (6.14,0.5) sin (F) cos (5.86,0.5) sin (D);
              draw [style=dashed] (-2,0)--(6.5,0) (0,2)--(0,-2);
              %located zoomed figure
              coordinate (zoomLoc) at (8,0);
              spy [red,on background layer,
              spy connection path=draw (tikzspyonnode) -- (tikzspyinnode);
              beginpgfonlayerforeground % https://tex.stackexchange.com/a/426272/121799
              beginscope[shift=(tikzspyinnode.south west),x=($(tikzspyinnode.south east)-(tikzspyinnode.south west)$),
              y=($(tikzspyinnode.north west)-(tikzspyinnode.south west)$)]
              draw[Latex[open]-,black,double=white] (0.15,0.75) -- ++ (0.5,0.5) -- ++ (0.5,0)
              node[right,minimum size=0pt]A;
              draw[Latex[open,fill=white]-,black,double=white] (0.5,0.5) --
              ++ (0.35,0.35) -- ++ (0.35,0) node[right,minimum size=0pt]B;
              draw[Latex[open,fill=white]-,black,double=white] (0.8,0.4) --
              ++ (0.25,-0.25) -- ++ (0.15,0) node[right,minimum size=0pt]C;
              endscope
              endpgfonlayer] on (4,1.25) in node at (zoomLoc);
              endtikzpicture
              enddocument


              enter image description here






              share|improve this answer






















                up vote
                4
                down vote










                up vote
                4
                down vote









                Here is an answer that is based on this older answer and conceptionally very similar to Milo's nice answer. The slight advantage is that this answer comes with a local coordinate system for the zoomed part, which may make it more straightforward to place the annotations. In particular, if you ever decide to move the zoomed in stuff around and/or change the zoom factor, the annotations will adjust. Milos approach is also fine with moving the zoomed stuff around. I also use outlined arrows for the sake of a better visibility.



                documentclass[tikz,margin=0.5cm]standalone
                usetikzlibrarypatterns,spy,backgrounds,calc,arrows.meta
                pgfdeclarelayerforeground
                pgfsetlayersbackground,main,foreground

                begindocument
                tikzsetevery spy on node/.append style=alias=zoom
                begintikzpicture[remember picture,scale=1,spy using outlines=circle, magnification=4,size=2.5cm, connect spies]
                coordinate (center) at (0,0);
                coordinate (A) at (2,1.5);
                coordinate (B) at (6,1.5);
                coordinate (C) at (2,1);
                coordinate (D) at (6,1);
                coordinate (E) at (2,0);
                coordinate (F) at (6,0);
                coordinate (G) at (2,-1);
                coordinate (H) at (6,-1);
                coordinate (I) at (2,-1.5);
                coordinate (J) at (6,-1.5);
                %Upper
                foreach x / y / z in 3.9/1.5/K, 4.1/1.5/L, 3.9/1/M, 4.1/1/N,3.8/1.5/O, 3.8/1.3/P, 3.9/1.3/Q, 4.1/1.1/R, 4.2/1.1/S, 4.2/1.5/T
                coordinate (z) at (x, y);
                filldraw (K)--(M)--(N)--(L)--(K);
                draw (O)--(P)--(Q);
                draw (R)--(S)--(T);
                %Lower
                foreach x / y / z in 3.9/-1.5/K, 4.1/-1.5/L, 3.9/-1/M, 4.1/-1/N, 3.8/-1.5/O, 3.8/-1.3/P, 3.9/-1.3/Q, 4.1/-1.1/R, 4.2/-1.1/S, 4.2/-1.5/T
                coordinate (z) at (x, y);
                filldraw (K)--(M)--(N)--(L)--(K);
                draw (O)--(P)--(Q);
                draw (R)--(S)--(T);
                %The left figure
                draw [->] (-0.3,0.7) arc [start angle=150, end angle=30, radius=10pt];
                draw (center) circle [radius=1.5cm];
                draw (center) circle [radius=1cm];
                foreach x / y in 0/30,10/40,20/50,30/60,40/70,50/80,60/90,70/100,80/110,90/120,100/130,110/140,120/150,130/160,140/170,150/180,160/190,170/200,180/210,190/220,200/230,210/240,220/250,230/260,240/270,250/280,260/290,270/300,280/310,290/320,300/330,310/340,320/350,330/360,340/10,350/20
                draw (x:1) -- (y:1.5);
                %The right figure
                draw (A)--(B);
                draw (C)--(D);
                draw (G)--(H);
                draw (I)--(J);
                draw (C) cos (1.86,0.5) sin (E);
                filldraw [pattern=north east lines] (E) cos (2.14,-0.5) sin(G) cos (1.86,-0.5) sin (E);
                %draw (E) cos (1.86,-0.5) sin (G);
                draw (F) cos (6.14,-0.5) sin(H);
                filldraw [pattern=north east lines](D) cos (6.14,0.5) sin (F) cos (5.86,0.5) sin (D);
                draw [style=dashed] (-2,0)--(6.5,0) (0,2)--(0,-2);
                %located zoomed figure
                coordinate (zoomLoc) at (8,0);
                spy [red,on background layer,
                spy connection path=draw (tikzspyonnode) -- (tikzspyinnode);
                beginpgfonlayerforeground % https://tex.stackexchange.com/a/426272/121799
                beginscope[shift=(tikzspyinnode.south west),x=($(tikzspyinnode.south east)-(tikzspyinnode.south west)$),
                y=($(tikzspyinnode.north west)-(tikzspyinnode.south west)$)]
                draw[Latex[open]-,black,double=white] (0.15,0.75) -- ++ (0.5,0.5) -- ++ (0.5,0)
                node[right,minimum size=0pt]A;
                draw[Latex[open,fill=white]-,black,double=white] (0.5,0.5) --
                ++ (0.35,0.35) -- ++ (0.35,0) node[right,minimum size=0pt]B;
                draw[Latex[open,fill=white]-,black,double=white] (0.8,0.4) --
                ++ (0.25,-0.25) -- ++ (0.15,0) node[right,minimum size=0pt]C;
                endscope
                endpgfonlayer] on (4,1.25) in node at (zoomLoc);
                endtikzpicture
                enddocument


                enter image description here






                share|improve this answer












                Here is an answer that is based on this older answer and conceptionally very similar to Milo's nice answer. The slight advantage is that this answer comes with a local coordinate system for the zoomed part, which may make it more straightforward to place the annotations. In particular, if you ever decide to move the zoomed in stuff around and/or change the zoom factor, the annotations will adjust. Milos approach is also fine with moving the zoomed stuff around. I also use outlined arrows for the sake of a better visibility.



                documentclass[tikz,margin=0.5cm]standalone
                usetikzlibrarypatterns,spy,backgrounds,calc,arrows.meta
                pgfdeclarelayerforeground
                pgfsetlayersbackground,main,foreground

                begindocument
                tikzsetevery spy on node/.append style=alias=zoom
                begintikzpicture[remember picture,scale=1,spy using outlines=circle, magnification=4,size=2.5cm, connect spies]
                coordinate (center) at (0,0);
                coordinate (A) at (2,1.5);
                coordinate (B) at (6,1.5);
                coordinate (C) at (2,1);
                coordinate (D) at (6,1);
                coordinate (E) at (2,0);
                coordinate (F) at (6,0);
                coordinate (G) at (2,-1);
                coordinate (H) at (6,-1);
                coordinate (I) at (2,-1.5);
                coordinate (J) at (6,-1.5);
                %Upper
                foreach x / y / z in 3.9/1.5/K, 4.1/1.5/L, 3.9/1/M, 4.1/1/N,3.8/1.5/O, 3.8/1.3/P, 3.9/1.3/Q, 4.1/1.1/R, 4.2/1.1/S, 4.2/1.5/T
                coordinate (z) at (x, y);
                filldraw (K)--(M)--(N)--(L)--(K);
                draw (O)--(P)--(Q);
                draw (R)--(S)--(T);
                %Lower
                foreach x / y / z in 3.9/-1.5/K, 4.1/-1.5/L, 3.9/-1/M, 4.1/-1/N, 3.8/-1.5/O, 3.8/-1.3/P, 3.9/-1.3/Q, 4.1/-1.1/R, 4.2/-1.1/S, 4.2/-1.5/T
                coordinate (z) at (x, y);
                filldraw (K)--(M)--(N)--(L)--(K);
                draw (O)--(P)--(Q);
                draw (R)--(S)--(T);
                %The left figure
                draw [->] (-0.3,0.7) arc [start angle=150, end angle=30, radius=10pt];
                draw (center) circle [radius=1.5cm];
                draw (center) circle [radius=1cm];
                foreach x / y in 0/30,10/40,20/50,30/60,40/70,50/80,60/90,70/100,80/110,90/120,100/130,110/140,120/150,130/160,140/170,150/180,160/190,170/200,180/210,190/220,200/230,210/240,220/250,230/260,240/270,250/280,260/290,270/300,280/310,290/320,300/330,310/340,320/350,330/360,340/10,350/20
                draw (x:1) -- (y:1.5);
                %The right figure
                draw (A)--(B);
                draw (C)--(D);
                draw (G)--(H);
                draw (I)--(J);
                draw (C) cos (1.86,0.5) sin (E);
                filldraw [pattern=north east lines] (E) cos (2.14,-0.5) sin(G) cos (1.86,-0.5) sin (E);
                %draw (E) cos (1.86,-0.5) sin (G);
                draw (F) cos (6.14,-0.5) sin(H);
                filldraw [pattern=north east lines](D) cos (6.14,0.5) sin (F) cos (5.86,0.5) sin (D);
                draw [style=dashed] (-2,0)--(6.5,0) (0,2)--(0,-2);
                %located zoomed figure
                coordinate (zoomLoc) at (8,0);
                spy [red,on background layer,
                spy connection path=draw (tikzspyonnode) -- (tikzspyinnode);
                beginpgfonlayerforeground % https://tex.stackexchange.com/a/426272/121799
                beginscope[shift=(tikzspyinnode.south west),x=($(tikzspyinnode.south east)-(tikzspyinnode.south west)$),
                y=($(tikzspyinnode.north west)-(tikzspyinnode.south west)$)]
                draw[Latex[open]-,black,double=white] (0.15,0.75) -- ++ (0.5,0.5) -- ++ (0.5,0)
                node[right,minimum size=0pt]A;
                draw[Latex[open,fill=white]-,black,double=white] (0.5,0.5) --
                ++ (0.35,0.35) -- ++ (0.35,0) node[right,minimum size=0pt]B;
                draw[Latex[open,fill=white]-,black,double=white] (0.8,0.4) --
                ++ (0.25,-0.25) -- ++ (0.15,0) node[right,minimum size=0pt]C;
                endscope
                endpgfonlayer] on (4,1.25) in node at (zoomLoc);
                endtikzpicture
                enddocument


                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Aug 11 at 22:43









                marmot

                54.9k459119




                54.9k459119



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f445681%2fadd-arrow-and-words-on-a-magnified-pic-using-tikz-spy%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Comments

                    Popular posts from this blog

                    What does second last employer means? [closed]

                    List of Gilmore Girls characters

                    One-line joke