Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wolfram mathematica 如何将ListPlot的图形与Plot的图形结合起来?_Wolfram Mathematica - Fatal编程技术网

Wolfram mathematica 如何将ListPlot的图形与Plot的图形结合起来?

Wolfram mathematica 如何将ListPlot的图形与Plot的图形结合起来?,wolfram-mathematica,Wolfram Mathematica,有没有办法将列表图的图形与图的图形结合起来?(我需要在ListPlot的图形上绘制函数的图形)从您的第二行开始,我认为您正在寻找的是Epilog。下面是一个例子: f[x_] := 1/Sqrt[2 Pi] Exp[-(x^2)/2]; ListPlot[ Table[ {x, PDF[NormalDistribution[], x]}, {x, -4, 4, 0.1} ], Epilog -> First@Plot[f[x], {x, -4, 4}, PlotStyle -&

有没有办法将
列表图的图形
图的图形
结合起来?(我需要在ListPlot的图形上绘制函数的图形)

从您的第二行开始,我认为您正在寻找的是
Epilog
。下面是一个例子:

f[x_] := 1/Sqrt[2 Pi] Exp[-(x^2)/2];
ListPlot[
 Table[
  {x, PDF[NormalDistribution[], x]}, {x, -4, 4, 0.1}
  ],
 Epilog -> First@Plot[f[x], {x, -4, 4}, PlotStyle -> Red]
 ]

另一种方法是使用
Show

p1 = ListPlot[
   Table[
    {x, PDF[NormalDistribution[], x]}, {x, -4, 4, 0.1}
    ]
   ];
p2 = Plot[f[x], {x, -4, 4}, PlotStyle -> Red];
Show[p1,p2]

另一方面,如果我弄错了,您只是想将它们一个接一个地组合起来,那么您可以使用
GraphicsRow
GraphicsColumn

FullGraphics@GraphicsRow[{p1, p2}]

您可以将任何图形与
显示功能组合,如下所示:

Show[myListPlot, myPlot]
这概括为一次组合任意数量的绘图:
Show[p1,p2,p3,p4,…]
Show[{p1,p2,p3,p4,…}]


参考和图像来源:



如果
Show
没有按照正确的顺序堆叠图形,您也可以使用
Epilog
,但是将两个以上的图形与Epilog组合起来会很麻烦。

关于
Fit[]
的帮助中有很多很好的例子,我不明白您的最后一行。。。想解释一下为什么
Epilog
是过度的,或者你所说的“堆叠顺序”是什么意思吗?你应该将评论作为评论发布到其他答案上,原因有几个,但同样重要的是,当前的答案可能会在将来被删除,而其他答案可能会被删除posted@d00b:如果您查看文档,Epilog明确声明的目的是在制作第一张图形后在顶部渲染图形(例如,允许覆盖、遮罩和水印),而显示的目的是结合2D和3D图形,如点、线和曲面。此外,如果您希望组合2个以上的图形,Epilog将变得非常笨拙。每个人都有时间和地点。谢谢。那么,为什么mma文档在几个地方使用
Epilog
来覆盖图呢?一个例子是在应用程序中的
直方图下。