3

I am trying to zoom part of the plot residing in the axis environment. An idea I tried to use can be found here, however, when I try to compile to code, Latex reports an error. I would appreciate it if someone could provide a hint on how to circumvent this issue?

MWE can be found below.

% arara: pdflatex
% arara: clean: {files: [MWE_ScopeAxis.aux, MWE_ScopeAxis.log]}

\documentclass[tikz,border=1mm]{standalone}
\usepackage{amsmath, tikz, pgfplots}
\usetikzlibrary{calc,spy,shapes,positioning}
\pgfplotsset{compat=newest}


\begin{document}
\begin{tikzpicture}[spy/.style={%
draw,red,
line width=1pt,
circle,inner sep=0pt,
},
]

\newcommand*\myplots[1][]{
\addplot[color=blue,dashed]
table[row sep=crcr]{
1.250000000054 0.218471486504557\\1.27500000012472 0.235880794037559\\1.30000000004985 0.253093675278193\\1.32499999988962 0.269996702493353\\1.34999999996296 0.28660169532495\\1.37500000003271 0.302803529131698\\1.4 0.318627316831094\\1.42500000000018 0.333967811176506\\1.44999999975398 0.348915976282584\\1.47499999999985 0.363393665978672\\1.50000000000007 0.377386190083728\\1.52499999999677 0.391065980885588\\1.54999999999987 0.404406696565785\\1.5749999999932 0.417357153126701\\1.60000000000001 0.429890180101467\\1.62500000007965 0.441495914781593\\1.64999999998047 0.453420186117445\\1.67500000000006 0.464885624062778\\1.70000000000013 0.475698022605379\\1.72499999999977 0.486001302461843\\1.75000000007258 0.49588760557761\\1.77500000001522 0.505406921339204\\1.79999999999992 0.514575948858101\\1.8249999999994 0.523580224222934\\1.84999999999966 0.532346980549898\\1.87499999998767 0.540884368439134\\1.90000000002483 0.549236128880721\\1.92499999997271 0.557390601810701\\1.94999999999657 0.565349329095157\\1.97499999999941 0.573100654346336\\1.99999999999993 0.580661122004988\\2.02499999998678 0.588035048696743\\2.0499999999709 0.595221272967935\\2.07499999999558 0.602215073143855\\2.09999999981776 0.609014392276178\\2.12500000001126 0.615634705868222\\2.14999999999957 0.622107376143054\\2.17499999994578 0.628535289209435\\2.19999999832383 0.63479954406909\\2.225 0.640975653060916\\2.24999999999955 0.647023272731091\\2.27499999999981 0.652900079435489\\2.29999999999833 0.658608487562972\\2.32499999999118 0.664162521737991\\2.34999999999773 0.669564611132752\\2.3750000000001 0.674786909878852\\2.40000000000024 0.679871708587361\\2.42499999998267 0.68481930558268\\2.44999999993369 0.689620895991369\\2.475 0.694300387671984\\2.50000000000226 0.698847019454327\\2.52499999999607 0.703231052229968\\2.54999999999282 0.707335949070966\\2.575 0.711299740037372\\2.59999999997469 0.715121564545835\\2.62500000002107 0.719030281788718\\2.64999999998823 0.722750679025289\\2.67499999999833 0.726355404984384\\2.6999999999989 0.729841563597055\\2.72500000000001 0.733213147420525\\2.75000000000046 0.736469697155365\\2.77500000011202 0.739681867953894\\2.8 0.742786117829059\\2.82500000000028 0.745831867778158\\2.84999999999055 0.748760245235199\\2.87499999999654 0.751587709302175\\2.90000000000011 0.754337713416536\\2.92500000001402 0.756957274828441\\2.94999999995396 0.759357524849041\\2.97499999999574 0.761687855897812\\3.00000000000154 0.764338301992918\\};
% \addlegendentry{po:pid};

\addplot [color=green!50!black,dashed]
table[row sep=crcr]{
1.250000000054 0.590067068740046\\1.27500000012472 0.587559925194454\\1.30000000004985 0.586376714983635\\1.32499999988962 0.586069496190726\\1.34999999996296 0.586583764906821\\1.37500000003271 0.587586732327579\\1.4 0.589106686232638\\1.42500000000018 0.590799582313491\\1.44999999975398 0.592894933769734\\1.47499999999985 0.595115212158793\\1.50000000000007 0.597338496940835\\1.52499999999677 0.600163078036215\\1.54999999999987 0.603553183039573\\1.5749999999932 0.607355964366702\\1.60000000000001 0.611472392727962\\1.62500000007965 0.612640770551816\\1.64999999998047 0.618542970092304\\1.67500000000006 0.625478240488116\\1.70000000000013 0.63111283078678\\1.72499999999977 0.635924446858566\\1.75000000007258 0.640430875313834\\1.77500000001522 0.644633876853955\\1.79999999999992 0.647757322657836\\1.8249999999994 0.647552686193448\\1.84999999999966 0.647363620909126\\1.87499999998767 0.647117668558105\\1.90000000002483 0.646013166144435\\1.92499999997271 0.644422071010403\\1.94999999999657 0.642591297950079\\1.97499999999941 0.640866907916906\\1.99999999999993 0.639224831229371\\2.02499999998678 0.636685323281278\\2.0499999999709 0.633964341182746\\2.07499999999558 0.631446791852552\\2.09999999981776 0.628537387562625\\2.12500000001126 0.626107411465097\\2.14999999999957 0.624103000469\\2.17499999994578 0.62449136318196\\2.19999999832383 0.624449479840847\\2.225 0.6256877319412\\2.24999999999955 0.628088304645751\\2.27499999999981 0.630472877532383\\2.29999999999833 0.63283206246448\\2.32499999999118 0.635116015919806\\2.34999999999773 0.637322260692226\\2.3750000000001 0.640065236430338\\2.40000000000024 0.642534886174564\\2.42499999998267 0.644944092104574\\2.44999999993369 0.647313968075354\\2.475 0.649603381645786\\2.50000000000226 0.651905320157395\\2.52499999999607 0.654572686699921\\2.54999999999282 0.658065576936871\\2.575 0.661530686251933\\2.59999999997469 0.664985448106105\\2.62500000002107 0.667216476217143\\2.64999999998823 0.669895462979295\\2.67499999999833 0.672557424400875\\2.6999999999989 0.675234842685167\\2.72500000000001 0.677932291475736\\2.75000000000046 0.680659050710123\\2.77500000011202 0.683201448501821\\2.8 0.685708044714863\\2.82500000000028 0.688088365642656\\2.84999999999055 0.690571448381062\\2.87499999999654 0.693076214461211\\2.90000000000011 0.695575684929241\\2.92500000001402 0.698184293706798\\2.94999999995396 0.701235761040505\\2.97499999999574 0.704202908157281\\3.00000000000154 0.705980592056065\\};
}

\begin{axis}[%
width=6cm,
height=3.5cm,
unbounded coords=jump,
scale only axis,
xmin=1.25,
xmax=2,
ymin=-5,
ymax=20,
ylabel={$y$},
xlabel={$x$},
ytick = {0,5,10,15}
]

\def\spyviewersize{1.25cm}
\def\spyonclipreduce{0.5pt}

\def\spyfactorI{2}
\coordinate (spy-on 1) at (axis cs: 1.5,1);
\coordinate (spy-in 1) at (axis cs: 1.8,10);

\node[spy,minimum size={\spyviewersize/\spyfactorI}] (spy-on node 1) at (spy-on 1) {};
\node[spy,minimum size=\spyviewersize, fill = white] (spy-in node 1) at (spy-in 1) {};

\myplots

\begin{scope}
         \clip (spy-in 1) circle (0.5*\spyviewersize-\spyonclipreduce);
        \pgfmathsetmacro\sI{1/\spyfactorI}
        \begin{scope}[shift={($\sI*(spy-in 1)-\sI*(spy-on 1)$)}]%,scale around={\spyfactorI:(spy-on 1)}]
               \myplots
        \end{scope}
\end{scope}

\end{axis}

\end{tikzpicture}
\end{document}

An example working perfectly fine represents a slightly modified version of the code from here and you can also find it below. Nevertheless, the axis environment is not used and neither is the plot defined through a set of points.

% arara: pdflatex
% arara: clean: {files: [MWE_circle.aux, MWE_circle.bbl, MWE_circle.bcf, MWE_circle.blg, MWE_circle.log, MWE_circle.out, MWE_circle.run.xml, MWE_circle.toc, MWE_circle.ist, MWE_circle.slo, MWE_circle.glo, MWE_circle.synctex.gz]}

\documentclass[tikz,border=1mm]{standalone}

\usetikzlibrary{calc,positioning}

\begin{document}
\begin{tikzpicture}[
    % Style for the spy nodes and the connection line
    spy/.style={%
        draw,red,
        line width=1pt,
        circle,inner sep=0pt,
    },
]
    % Parameters

    %% size of the spy-in nodes
    \def\spyviewersize{1.25cm}

    %% (line width of the spy nodes) / 2
    %% we need this for clipping later
    \def\spyonclipreduce{0.5pt}

    %% first zoom
    %%% factor
    \def\spyfactorI{2}
    %%% spy on point
    \coordinate (spy-on 1) at (2.44,1);% sould be on the curve
    %%% spy in point
    \coordinate (spy-in 1) at (5,1);


    \def\spyfactorII{2}
    %%% spy on point (last spy in point)


    %% the graph/picture
    \def\pic{
        %%% grid
        %\draw [ultra thin,step=0.2,gray] (0,0) grid (6,6);
        %%% graph
        \draw [line width=2pt,green!70!black] (0,0) parabola [bend at start] (6,6);
        \draw [line width=2pt,red!70!black] (2,0) parabola [bend={(2.5,1)}] (3,0);
        %%% axes
        \draw [->] (0,0) -- (6,0) node [right] {$t$};
        \draw [->] (0,0) -- (0,6) node [left] {$x$};
    }


    % draw the original picture
    \pic


    % first zoom
    %% spy on node
    \node[spy,minimum size={\spyviewersize/\spyfactorI}] (spy-on node 1) at (spy-on 1) {};
    %% spy in node
    \node[spy,minimum size=\spyviewersize, fill = white] (spy-in node 1) at (spy-in 1) {};
    \begin{scope}
        \clip (spy-in 1) circle (0.5*\spyviewersize-\spyonclipreduce);
        \pgfmathsetmacro\sI{1/\spyfactorI}
        \begin{scope}[
            shift={($\sI*(spy-in 1)-\sI*(spy-on 1)$)},
            scale around={\spyfactorI:(spy-on 1)}
        ]
           \pic
        \end{scope}
    \end{scope}

    %% connect the nodes
    \draw [spy] (spy-on node 1) -- (spy-in node 1);

%    % print the factors
%    \node [above=0pt of spy-in node 1] {$\spyfactorI\times$};
%    \pgfmathsetmacro\spyfactor{\spyfactorI*\spyfactorII}

\end{tikzpicture}
\end{document}

On top of that, would it be possible to crop only the "zoomed" part of the plot and export it as a separate .pdf?

Thanks!

slm992
  • 43
  • 3
  • 1
    Welcome! Could you please explain a bit more what you want to achieve? The second code does not even use the spy library, and the codes that you are linking to magnify parts of plots without magnifying the line widths. Is that what you wish to achieve? –  May 08 '20 at 16:50
  • 1
    BTW, the error is due to the way pgfplots surveys and expands things. It is rather easy to fix, but before going into this it might make sense to understand what you are up to. That is, you may not be able to use the scale around key in pgfplots without further efforts. –  May 08 '20 at 17:09
  • @Schrödinger'scat Thank you for your answer. Exactly, I would like to magnify parts of the plot without magnifying line widths. Moreover, the plots should be in the axis environment. Lets say I have 5 axes stacked on each other and I would to magnify a part of one axis without making the lines super thick, which the part I disliked about "spy" command. :) – slm992 May 08 '20 at 17:13
  • 1
    OK, then this post seems to be what you are looking for. –  May 08 '20 at 17:15
  • @Schrödinger'scat Btw, I cant avoid using pgfplots since this is what I normally use to plot things. – slm992 May 08 '20 at 17:15
  • I knew about that one, but what if I want to have a circle instead of a rectangle? (thats why I referred to the above link) – slm992 May 08 '20 at 17:17
  • 1
    Changing a rectangle to a circle is much less headache than to get the expansion issues and transformations in pgfplots right. Basically Jake stores the coordinates in macros rather than using symbolic coordinates, which are not "ready" when they are needed due to the way pgfplots surveys and "does" things. –  May 08 '20 at 17:19
  • Okay, changing the parts with nodes is easy and so is the clip command. However, where I fail to succeed is the following part of code

    \begin{scope} \clip (spyviewer.south west) rectangle (spyviewer.north east); \pgfmathparse{\spyfactor^2/(\spyfactor-1)} \begin{scope}[scale around={\spyfactor:($(\spyviewer)!\spyfactor^2/(\spyfactor^2-1)!(\spypoint)$)}] \myplots \end{scope} \end{scope}

    – slm992 May 08 '20 at 17:25

2 Answers2

2

Here is some code with circle nodes. It is based on Jake's answer. If it does not solve all your problems, it might still be a better basis for discussions than posting code fragments in the comments.

\documentclass[tikz,border=1mm]{standalone}
\usepackage{amsmath}
\usepackage{pgfplots}
\usetikzlibrary{calc,positioning}
\pgfplotsset{compat=1.17}


\begin{document}
\begin{tikzpicture}[cspy/.style={%
draw,red,
line width=1pt,
circle,inner sep=0pt,
},]
\begin{axis}[%
width=6cm,
height=3.5cm,
unbounded coords=jump,
scale only axis,
xmax=2,
ymin=-5,
ymax=20,
ylabel={$y$},
xlabel={$x$},
ytick = {0,5,10,15}
]
\newcommand*\myplots[1][]{
\addplot [
color=blue,
dashed
]
table[row sep=crcr]{
1.250000000054 0.218471486504557\\1.27500000012472 0.235880794037559\\1.30000000004985 0.253093675278193\\1.32499999988962 0.269996702493353\\1.34999999996296 0.28660169532495\\1.37500000003271 0.302803529131698\\1.4 0.318627316831094\\1.42500000000018 0.333967811176506\\1.44999999975398 0.348915976282584\\1.47499999999985 0.363393665978672\\1.50000000000007 0.377386190083728\\1.52499999999677 0.391065980885588\\1.54999999999987 0.404406696565785\\1.5749999999932 0.417357153126701\\1.60000000000001 0.429890180101467\\1.62500000007965 0.441495914781593\\1.64999999998047 0.453420186117445\\1.67500000000006 0.464885624062778\\1.70000000000013 0.475698022605379\\1.72499999999977 0.486001302461843\\1.75000000007258 0.49588760557761\\1.77500000001522 0.505406921339204\\1.79999999999992 0.514575948858101\\1.8249999999994 0.523580224222934\\1.84999999999966 0.532346980549898\\1.87499999998767 0.540884368439134\\1.90000000002483 0.549236128880721\\1.92499999997271 0.557390601810701\\1.94999999999657 0.565349329095157\\1.97499999999941 0.573100654346336\\1.99999999999993 0.580661122004988\\2.02499999998678 0.588035048696743\\2.0499999999709 0.595221272967935\\2.07499999999558 0.602215073143855\\2.09999999981776 0.609014392276178\\2.12500000001126 0.615634705868222\\2.14999999999957 0.622107376143054\\2.17499999994578 0.628535289209435\\2.19999999832383 0.63479954406909\\2.225 0.640975653060916\\2.24999999999955 0.647023272731091\\2.27499999999981 0.652900079435489\\2.29999999999833 0.658608487562972\\2.32499999999118 0.664162521737991\\2.34999999999773 0.669564611132752\\2.3750000000001 0.674786909878852\\2.40000000000024 0.679871708587361\\2.42499999998267 0.68481930558268\\2.44999999993369 0.689620895991369\\2.475 0.694300387671984\\2.50000000000226 0.698847019454327\\2.52499999999607 0.703231052229968\\2.54999999999282 0.707335949070966\\2.575 0.711299740037372\\2.59999999997469 0.715121564545835\\2.62500000002107 0.719030281788718\\2.64999999998823 0.722750679025289\\2.67499999999833 0.726355404984384\\2.6999999999989 0.729841563597055\\2.72500000000001 0.733213147420525\\2.75000000000046 0.736469697155365\\2.77500000011202 0.739681867953894\\2.8 0.742786117829059\\2.82500000000028 0.745831867778158\\2.84999999999055 0.748760245235199\\2.87499999999654 0.751587709302175\\2.90000000000011 0.754337713416536\\2.92500000001402 0.756957274828441\\2.94999999995396 0.759357524849041\\2.97499999999574 0.761687855897812\\3.00000000000154 0.764338301992918\\};
% \addlegendentry{po:pid};

\addplot [
color=green!50!black,
dashed
]
table[row sep=crcr]{
1.250000000054 0.590067068740046\\1.27500000012472 0.587559925194454\\1.30000000004985 0.586376714983635\\1.32499999988962 0.586069496190726\\1.34999999996296 0.586583764906821\\1.37500000003271 0.587586732327579\\1.4 0.589106686232638\\1.42500000000018 0.590799582313491\\1.44999999975398 0.592894933769734\\1.47499999999985 0.595115212158793\\1.50000000000007 0.597338496940835\\1.52499999999677 0.600163078036215\\1.54999999999987 0.603553183039573\\1.5749999999932 0.607355964366702\\1.60000000000001 0.611472392727962\\1.62500000007965 0.612640770551816\\1.64999999998047 0.618542970092304\\1.67500000000006 0.625478240488116\\1.70000000000013 0.63111283078678\\1.72499999999977 0.635924446858566\\1.75000000007258 0.640430875313834\\1.77500000001522 0.644633876853955\\1.79999999999992 0.647757322657836\\1.8249999999994 0.647552686193448\\1.84999999999966 0.647363620909126\\1.87499999998767 0.647117668558105\\1.90000000002483 0.646013166144435\\1.92499999997271 0.644422071010403\\1.94999999999657 0.642591297950079\\1.97499999999941 0.640866907916906\\1.99999999999993 0.639224831229371\\2.02499999998678 0.636685323281278\\2.0499999999709 0.633964341182746\\2.07499999999558 0.631446791852552\\2.09999999981776 0.628537387562625\\2.12500000001126 0.626107411465097\\2.14999999999957 0.624103000469\\2.17499999994578 0.62449136318196\\2.19999999832383 0.624449479840847\\2.225 0.6256877319412\\2.24999999999955 0.628088304645751\\2.27499999999981 0.630472877532383\\2.29999999999833 0.63283206246448\\2.32499999999118 0.635116015919806\\2.34999999999773 0.637322260692226\\2.3750000000001 0.640065236430338\\2.40000000000024 0.642534886174564\\2.42499999998267 0.644944092104574\\2.44999999993369 0.647313968075354\\2.475 0.649603381645786\\2.50000000000226 0.651905320157395\\2.52499999999607 0.654572686699921\\2.54999999999282 0.658065576936871\\2.575 0.661530686251933\\2.59999999997469 0.664985448106105\\2.62500000002107 0.667216476217143\\2.64999999998823 0.669895462979295\\2.67499999999833 0.672557424400875\\2.6999999999989 0.675234842685167\\2.72500000000001 0.677932291475736\\2.75000000000046 0.680659050710123\\2.77500000011202 0.683201448501821\\2.8 0.685708044714863\\2.82500000000028 0.688088365642656\\2.84999999999055 0.690571448381062\\2.87499999999654 0.693076214461211\\2.90000000000011 0.695575684929241\\2.92500000001402 0.698184293706798\\2.94999999995396 0.701235761040505\\2.97499999999574 0.704202908157281\\3.00000000000154 0.705980592056065\\};
}
% work with explicit rather symbolic coordinates because of
% pgfplots' surveying
\newcommand*\spypoint{1.4,0.5}
\newcommand*\spyviewer{1.6,10}
\newcommand*\spyfactorI{2}
\newcommand*\spyviewersize{1.25cm}
\newcommand*\spyonclipreduce{0.5pt}

\myplots

\node[cspy,minimum size={\spyviewersize/\spyfactorI}] 
    (spy-on node 1) at (\spypoint) {};
\node[cspy,minimum size=\spyviewersize, fill = white] 
    (spy-in node 1) at (\spyviewer) {};

\draw (spy-on node 1) edge (spy-in node 1);
\begin{scope}
    \clip (\spyviewer) circle[radius=0.5*\spyviewersize-\spyonclipreduce];
    \pgfmathparse{\spyfactorI^2/(\spyfactorI-1)}
    \begin{scope}[scale around={\spyfactorI:($(\spyviewer)!\spyfactorI^2/(\spyfactorI^2-1)!(\spypoint)$)}]
        \myplots
    \end{scope}
\end{scope}
\end{axis}
\end{tikzpicture}%
\end{document}

enter image description here

1

After I "played" with the script from above, I figured out it is not really doing what I would like it to do.

If you were to consider the example from bellow, it can be seen that "zoom-in" part of the plot contains 5 lines where as "zoom-on" part contains only three. Basically, I would like to have the content of a smaller circle enlarged "spyfactorI" times and presented on the same plot.

Another question refers to the part of code

{\spyfactorI:($(\spyviewer)!\spyfactorI^2/(\spyfactorI^2-1)!(\spypoint)$)}]

Where can I find more info on how to read this syntax?

Thank you!

  \documentclass[tikz,border=1mm]{standalone}
    \usepackage{amsmath}
    \usepackage{pgfplots}
    \usetikzlibrary{calc,positioning}

    \pgfplotsset{
    every axis/.append style={
        xticklabel style = {font=\tiny,/pgf/number format/fixed,/pgf/number format/precision=5},
        yticklabel style = {font=\tiny,/pgf/number format/fixed,/pgf/number format/precision=5},
        zticklabel style = {font=\tiny,/pgf/number format/fixed,/pgf/number format/precision=5},
        xlabel style = {font=\tiny},
        y label style={font=\tiny, at={(-.15,.5)},rotate=0,anchor=south, align = center},
        zlabel style = {font=\tiny},
        legend style = {font=\tiny},
        legend style ={at={(.99,0.04)}, anchor=south east, legend cell align=left, align=left, draw=white!15!black, column sep = 0.25pt, row sep = 0pt, legend image post style={xscale=.5}, font = \tiny}
      },
      every axis plot/.append style={line width=0.5pt,line cap=round},
      compat=newest,
    }

    \definecolor{mycolor1}{rgb}{0.10588,0.61961,0.46667}%
    \definecolor{mycolor2}{rgb}{0.85098,0.37255,0.00784}%


    \begin{document}

    \begin{tikzpicture}[cspy/.style={%
    draw,red,
    line width=1pt,
    circle,inner sep=0pt,
    },]
    \begin{axis}[%
    width=6cm,
    height=3.5cm,
    unbounded coords=jump,
    scale only axis,
    xmin = 0.3,
    xmax=0.6,
    ymin=-2900,
    ymax=2900,
    ylabel={$y$},
    xlabel={$x$},
    ]
    \newcommand*\myplots[1][]{
    \addplot [color=mycolor1,  join = round]
    table[row sep=crcr]{%
    0   0\\
    0.349370002746582   0\\
    0.349860012531281   -1254.50256347656\\
    0.355250000953674   2693.71899414063\\
    0.356229990720749   2534.44995117188\\
    0.358680009841919   798.401306152344\\
    0.363580018281937   -2693.638671875\\
    0.364560008049011   -2535.59692382813\\
    0.367009997367859   -801.633911132813\\
    0.371910005807877   2693.55395507813\\
    0.372889995574951   2536.74047851563\\
    0.375340014696121   804.866027832031\\
    0.380239993333817   -2693.46533203125\\
    0.381220012903214   -2537.8798828125\\
    0.383670002222061   -808.097229003906\\
    0.388570010662079   2693.3720703125\\
    0.389550000429153   2539.015625\\
    0.392000019550323   811.327087402344\\
    0.396899998188019   -2693.2744140625\\
    0.397880017757416   -2540.14672851563\\
    0.400330007076263   -814.553894042969\\
    0.405230015516281   2693.17309570313\\
    0.406210005283356   2541.27416992188\\
    0.408659994602203   817.780822753906\\
    0.413560003042221   -2693.06689453125\\
    0.414539992809296   -2542.3974609375\\
    0.416990011930466   -821.007385253906\\
    0.421889990568161   2692.95678710938\\
    0.422870010137558   2543.51684570313\\
    0.425319999456406   824.232543945313\\
    0.430220007896423   -2692.8427734375\\
    0.431199997663498   -2544.63256835938\\
    0.433650016784668   -827.45556640625\\
    0.438549995422363   2692.7236328125\\
    0.43953001499176    2545.7431640625\\
    0.441980004310608   830.676391601563\\
    0.446880012750626   -2692.60083007813\\
    0.4478600025177 -2546.8505859375\\
    0.450309991836548   -833.895935058594\\
    0.455210000276566   2692.4736328125\\
    0.456190019845963   2547.95336914063\\
    0.45864000916481    837.114624023438\\
    0.463540017604828   -2692.34228515625\\
    0.464520007371902   -2549.052734375\\
    0.46696999669075    -840.332763671875\\
    0.471870005130768   2692.20678710938\\
    0.472849994897842   2550.14819335938\\
    0.475300014019012   843.5498046875\\
    0.480199992656708   -2692.06689453125\\
    0.481180012226105   -2551.2392578125\\
    0.483630001544952   -846.764282226563\\
    0.48853000998497    2691.92260742188\\
    0.489509999752045   2552.326171875\\
    0.491960018873215   849.977966308594\\
    0.49685999751091    -2691.77416992188\\
    0.497840017080307   -2553.40942382813\\
    0.500289976596832   -853.190795898438\\
    0.505190014839172   2691.62158203125\\
    0.506170034408569   2554.48876953125\\
    0.508620023727417   856.402099609375\\
    0.513520002365112   -2691.46459960938\\
    0.514500021934509   -2555.56396484375\\
    0.516950011253357   -859.6123046875\\
    0.521849989891052   2691.30322265625\\
    0.522339999675751   2669.38427734375\\
    0.523810029029846   2076.95092773438\\
    0.530179977416992   -2691.13793945313\\
    0.530669987201691   -2669.8427734375\\
    0.532140016555786   -2079.1064453125\\
    0.538510024547577   2690.96850585938\\
    0.539000034332275   2670.29663085938\\
    0.540470004081726   2081.25732421875\\
    0.546840012073517   -2690.79443359375\\
    0.547330021858215   -2670.74682617188\\
    0.548799991607666   -2083.40600585938\\
    0.555169999599457   2690.6162109375\\
    0.555660009384155   2671.19311523438\\
    0.557129979133606   2085.55200195313\\
    0.563499987125397   -2690.43383789063\\
    0.563989996910095   -2671.634765625\\
    0.565460026264191   -2087.69409179688\\
    0.571830034255981   2690.2470703125\\
    0.572319984436035   2672.07202148438\\
    0.573790013790131   2089.83325195313\\
    0.580160021781921   -2690.05615234375\\
    0.58065003156662    -2672.50537109375\\
    0.582120001316071   -2091.96826171875\\
    0.588490009307861   2689.86083984375\\
    0.58898001909256    2672.93432617188\\
    0.590449988842011   2094.10107421875\\
    0.596819996833801   -2689.66162109375\\
    0.5973100066185 -2673.35913085938\\
    0.598780035972595   -2096.23095703125\\
    0.605149984359741   2689.45776367188\\
    0.60563999414444    2673.78002929688\\
    0.607110023498535   2098.35620117188\\
    0.613480031490326   -2689.25\\
    0.61396998167038    -2674.1962890625\\
    0.615440011024475   -2100.47827148438\\
    0.621810019016266   2689.03784179688\\
    0.622300028800964   2674.6083984375\\
    };
    \addplot [color=mycolor2,  join = round]
      table[row sep=crcr]{%
    0   0\\
    0.349370002746582   0\\
    0.349860012531281   2692.3583984375\\
    0.351330012083054   2233.69555664063\\
    0.35819000005722    -2692.48950195313\\
    0.359659999608994   -2235.58764648438\\
    0.366520017385483   2692.61572265625\\
    0.367500007152557   2475.15014648438\\
    0.370440006256104   151.363052368164\\
    0.374850004911423   -2692.73828125\\
    0.375829994678497   -2476.486328125\\
    0.378769993782043   -154.744110107422\\
    0.383179992437363   2692.8564453125\\
    0.38416001200676    2477.81884765625\\
    0.387100011110306   158.12467956543\\
    0.391510009765625   -2692.970703125\\
    0.3924899995327 -2479.14721679688\\
    0.395429998636246   -161.504196166992\\
    0.399839997291565   2693.080078125\\
    0.400820016860962   2480.47094726563\\
    0.403760015964508   164.883895874023\\
    0.408170014619827   -2693.185546875\\
    0.409150004386902   -2481.79125976563\\
    0.412090003490448   -168.26318359375\\
    0.416500002145767   2693.28662109375\\
    0.417479991912842   2483.10815429688\\
    0.420419991016388   171.643829345703\\
    0.42483001947403    -2693.38354492188\\
    0.425810009241104   -2484.42114257813\\
    0.42875000834465    -175.022644042969\\
    0.433160006999969   2693.47607421875\\
    0.434139996767044   2485.7294921875\\
    0.43707999587059    178.400238037109\\
    0.441489994525909   -2693.564453125\\
    0.442470014095306   -2487.0341796875\\
    0.445410013198853   -181.779281616211\\
    0.449820011854172   2693.64868164063\\
    0.450800001621246   2488.33447265625\\
    0.453740000724792   185.156402587891\\
    0.458149999380112   -2693.72827148438\\
    0.459130018949509   -2489.63110351563\\
    0.462070018053055   -188.533767700195\\
    0.466480016708374   2693.80419921875\\
    0.467460006475449   2490.92431640625\\
    0.470400005578995   191.912094116211\\
    0.474810004234314   -2693.87524414063\\
    0.475789994001389   -2492.21362304688\\
    0.478729993104935   -195.289855957031\\
    0.483139991760254   2693.9423828125\\
    0.484120011329651   2493.49853515625\\
    0.487060010433197   198.665115356445\\
    0.491470009088516   -2694.00537109375\\
    0.492449998855591   -2494.77954101563\\
    0.495389997959137   -202.042236328125\\
    0.499799996614456   2694.06372070313\\
    0.500779986381531   2496.056640625\\
    0.503719985485077   205.41960144043\\
    0.508130013942719   -2694.11840820313\\
    0.509110033512115   -2497.32983398438\\
    0.512050032615662   -208.796646118164\\
    0.516460001468658   2694.16845703125\\
    0.517440021038055   2498.59936523438\\
    0.520380020141602   212.171112060547\\
    0.524789988994598   -2694.21411132813\\
    0.525770008563995   -2499.86450195313\\
    0.528710007667542   -215.545822143555\\
    0.533120036125183   2694.255859375\\
    0.534099996089935   2501.12573242188\\
    0.537039995193481   218.919891357422\\
    0.541450023651123   -2694.29296875\\
    0.542429983615875   -2502.3828125\\
    0.544880032539368   -711.730346679688\\
    0.549780011177063   2694.32641601563\\
    0.55076003074646    2503.63647460938\\
    0.553210020065308   714.996032714844\\
    0.558109998703003   -2694.35522460938\\
    0.5590900182724 -2504.88598632813\\
    0.561540007591248   -718.260620117188\\
    0.566439986228943   2694.3798828125\\
    0.56742000579834    2506.1318359375\\
    0.569869995117188   721.523376464844\\
    0.574770033359528   -2694.39990234375\\
    0.57574999332428    -2507.37280273438\\
    0.578199982643127   -724.783813476563\\
    0.583100020885468   2694.416015625\\
    0.58407998085022    2508.6103515625\\
    0.586530029773712   728.045227050781\\
    0.591430008411407   -2694.42797851563\\
    0.592410027980804   -2509.84423828125\\
    0.594860017299652   -731.305908203125\\
    0.599759995937347   2694.43530273438\\
    0.600740015506744   2511.07446289063\\
    0.603190004825592   734.564208984375\\
    0.608089983463287   -2694.43872070313\\
    0.609070003032684   -2512.30053710938\\
    0.611519992351532   -737.820556640625\\
    0.616420030593872   2694.43774414063\\
    0.617399990558624   2513.52172851563\\
    0.619849979877472   741.076904296875\\
    0.624750018119812   -2694.4326171875\\
    0.625729978084564   -2514.7392578125\\
    };
    }

    % work with explicit rather symbolic coordinates because of
    % pgfplots' surveying
    \newcommand*\spypoint{0.4,0}
    \newcommand*\spyviewer{0.55,0}
    \newcommand*\spyfactorI{2}
    \newcommand*\spyviewersize{1cm}
    \newcommand*\spyonclipreduce{0.5pt}

    \myplots

    \node[cspy,minimum size={\spyviewersize/\spyfactorI}] 
        (spy-on node 1) at (\spypoint) {};
    \node[cspy,minimum size=\spyviewersize, fill = white] 
       (spy-in node 1) at (\spyviewer) {};

    %\draw (spy-on node 1) edge (spy-in node 1);
    \begin{scope}
        \clip (\spyviewer) circle[radius=0.5*\spyviewersize-\spyonclipreduce];
        \pgfmathparse{\spyfactorI^2/(\spyfactorI-1)}
        \begin{scope}[scale around={\spyfactorI:($(\spyviewer)!\spyfactorI^2/(\spyfactorI^2-1)!(\spypoint)$)}]
            \myplots
        \end{scope}
    \end{scope}
    \end{axis}
    \end{tikzpicture}%

    \end{document}

enter image description here

slm992
  • 43
  • 3