使用 PSTricks 制作插图

使用 PSTricks 制作插图

我有一个主坐标系,我想在其中绘制一些插图中的数据。这是我的 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}

我想将数据绘制在插图中,并希望能够在“主”坐标系内自由移动。在 PSTricks 中有没有一种智能方法可以做到这一点?

编辑:我真诚地道歉,但我忘了注意插图应该有帕萨克斯包括标签。此编辑已完成赫伯特的回答。

答案1

\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}

在此处输入图片描述

也可以看看http://tug.org/PSTricks/main.cgi?file=pst-plot/fileplot 第一个例子以另一种比例显示了数据图的特定部分。

如果需要它与坐标系一起,则定义自己的命令:

\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}

在此处输入图片描述

相关内容