5

I have a main coordinate system, and inside this I would like to plot some data in an inset. Here is my MWE:

\documentclass[pstricks,border=16pt]{standalone}
\usepackage{pst-node, pst-coil, pst-plot}
\psset
{
    unit=0.1cm,
}

\begin{document}
\begin{pspicture}[showgrid=false](0.0, -25)(108, 23.0)
\psaxes[Dx=10,Dy=10,linewidth=1pt, ticksize=2pt, Oy=-20]{->}(0.0,-20)(105,20)%THIS IS THE MAIN COORDINATE SYSTEM

%THIS IS MY DATA FOR THE INSET
\savedata{\mydata}[
{{0, 0}, {1., 0.946083}, {2., 1.60541}, {3., 1.84865}, {4., 1.7582},
{5., 1.54993}, {6., 1.42469}, {7., 1.4546}, {8., 1.57419},
{9., 1.66504}, {10., 1.65835}, {11., 1.57831}, {12., 1.50497},
{13., 1.49936}, {14., 1.55621}, {15., 1.61819}, {16., 1.6313},
{17., 1.59014}, {18., 1.53661}, {19., 1.51863}, {20., 1.54824}}]
\end{pspicture}
\end{document}

The data I want to plot in an inset, which I would like to be able to move around freely inside the "main" coordinate system. Is there a smart way to do this in PSTricks?

EDIT: I sincerely apologize, but I forgot to note that the inset-plot should have psaxes including labels. This edit was made after Herbert's answer.

1
  • Please don't use graphics tag because it is irrelevant. Oct 12, 2013 at 16:29

1 Answer 1

6
\documentclass[pstricks,border=16pt]{standalone}
\usepackage{pst-plot}
\psset{unit=0.1}
\begin{document}

\savedata{\mydata}[
{{0, 0}, {1., 0.946083}, {2., 1.60541}, {3., 1.84865}, {4., 1.7582},
{5., 1.54993}, {6., 1.42469}, {7., 1.4546}, {8., 1.57419},
{9., 1.66504}, {10., 1.65835}, {11., 1.57831}, {12., 1.50497},
{13., 1.49936}, {14., 1.55621}, {15., 1.61819}, {16., 1.6313},
{17., 1.59014}, {18., 1.53661}, {19., 1.51863}, {20., 1.54824}}]

\begin{pspicture}(-5, -25)(108, 23.0)
\psaxes[Dx=10,Dy=10,linewidth=1pt, ticksize=2pt, Oy=-20]{->}(0.0,-20)(105,20)%THIS IS THE MAIN COORDINATE SYSTEM
\listplot[linecolor=blue]{\mydata}
\rput(50,-10){\listplot[linecolor=red]{\mydata}}
\rput(70,10){\listplot[linecolor=green]{\mydata}}
\end{pspicture}

\end{document}

enter image description here

See also http://tug.org/PSTricks/main.cgi?file=pst-plot/fileplot the first example shows a specific part of a data plot in another scaling.

If you need it together with a coordinate system then define an own command:

\documentclass[pstricks,border=16pt]{standalone}
\usepackage{pst-plot}
\psset{unit=0.1}

\savedata{\mydata}[
{{0, 0}, {1., 0.946083}, {2., 1.60541}, {3., 1.84865}, {4., 1.7582},
{5., 1.54993}, {6., 1.42469}, {7., 1.4546}, {8., 1.57419},
{9., 1.66504}, {10., 1.65835}, {11., 1.57831}, {12., 1.50497},
{13., 1.49936}, {14., 1.55621}, {15., 1.61819}, {16., 1.6313},
{17., 1.59014}, {18., 1.53661}, {19., 1.51863}, {20., 1.54824}}]

\makeatletter
\def\myPlot{\@ifnextchar[\myPlot@i{\myPlot@i[]}}
\def\myPlot@i[#1](#2)#3#4{{%
  \rput[lb](#2){%
    \begin{pspicture}(0,0)(25,15)
    \listplot[#1]{#3}%
    \psaxes[Dx=10,Dy=10,linewidth=1pt,ticksize=2pt,linecolor=black,#4]{->}(0,0)(25,15)
  \end{pspicture}}%
}}
\makeatother

\begin{document}

\begin{pspicture}(-5, -25)(108, 23.0)
\psaxes[Dx=10,Dy=10,linewidth=1pt, ticksize=2pt, Oy=-20]{->}(0.0,-20)(105,20)
\myPlot[linecolor=red](0,0){\mydata}{}
\myPlot[linecolor=red](50,-10){\mydata}{labelFontSize=\scriptscriptstyle}
\myPlot[linecolor=green](70,10){\mydata}{ticksize=-4pt 4pt
\end{pspicture}

\end{document}

enter image description here

13
  • I sincerely apologize, but I forgot to add in my OP that the inset-plot show have psaxes with labels. I will edit my OP.
    – BillyJean
    Oct 12, 2013 at 17:41
  • 1
    see my enhanced answer. It has a second example
    – user2478
    Oct 12, 2013 at 18:02
  • What if I want to be able to control the sizes of the ticklabels of the inset-plots independently of the main ticklabels? Let me know if I should create a new thread instead of asking here.. seems relevant to continue here
    – BillyJean
    Oct 12, 2013 at 20:11
  • 1
    sure! Hold the definition for the rotation lokal
    – user2478
    Oct 13, 2013 at 5:06
  • 1
    In the inset macro you can set everything. It should already local.
    – user2478
    Oct 13, 2013 at 10:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .