如何使用 pgfplots 在 LaTeX 中绘制以下图表?

如何使用 pgfplots 在 LaTeX 中绘制以下图表?

有谁能帮我绘制图形中的图形吗?在此处输入图片描述

答案1

这应该能给你一个起点。

\documentclass{article}
\usepackage{pgfplots}

\pgfplotsset{
  inset/.style args={#1,(#2,#3)}{
    width=4cm,height=3cm,
    at=(mainplot.center),
    name=#1,
    shift={(#2,#3)},
  }
}

\begin{document}

\begin{tikzpicture}
  \begin{axis}[name=mainplot,
    ymajorgrids,xmin=0,xmax=800,ymin=0,ymax=40,
    width=\linewidth]
    \addplot+[only marks] coordinates {
      (0,36) (100,27) (200,14) (300,13) (400,11) (500,15) (600,24) (700,17)
    };
    \addplot+[only marks] coordinates {
      (0,19) (100,22) (200,16) (300,16) (400,26)
    };
    \addplot+[no marks,blue,domain=0:700] {(35-12)/400^2*(x-400)^2+12};
    \addplot+[no marks,red,domain=0:400]  {(21-17)/170^2*(x-170)^2+17};
    \node (ref-i1) at (axis cs:0,36)   {};
    \node (ref-i2) at (axis cs:400,26) {};
    \node (ref-i3) at (axis cs:300,13) {};
    \node (ref-i4) at (axis cs:500,15) {};
  \end{axis}
  \begin{axis}[inset={i1,(-4.2cm,2.7cm)}]
    \addplot+[blue,no marks,samples=200] {rnd};
  \end{axis}
  \begin{axis}[inset={i2,(.5cm,1.5cm)}]
    \addplot+[red,no marks,samples=200] {rnd};
  \end{axis}
  \begin{axis}[inset={i3,(-3.2cm,-3.5cm)}]
    \addplot+[blue,no marks,samples=200] {rnd};
  \end{axis}
  \begin{axis}[inset={i4,(2cm,-3cm)}]
    \addplot+[blue,no marks,samples=200] {rnd};
  \end{axis}
  \draw[blue,->] (i1) -- (ref-i1);
  \draw[red, ->] (i2) -- (ref-i2);
  \draw[blue,->] (i3) -- (ref-i3);
  \draw[blue,->] (i4) -- (ref-i4);
\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容