使用multiplot一起绘制等高线图和曲线

使用multiplot一起绘制等高线图和曲线,plot,gnuplot,Plot,Gnuplot,我试图使用multiplot在等高线图上覆盖一条曲线,下面是我的gnuplot脚本 set term postscript enhanced color 'Times-Roman,24' set output 'cimax_pmf.eps' set encoding iso_8859_1 set nokey set xlabel 'RC(\305)' set xrange [0:12] set yrange [0.2:1] set ylabel 'c^2_{imax}' set y2labe

我试图使用multiplot在等高线图上覆盖一条曲线,下面是我的gnuplot脚本

set term postscript enhanced color 'Times-Roman,24'

set output 'cimax_pmf.eps'
set encoding iso_8859_1

set nokey
set xlabel 'RC(\305)'
set xrange [0:12]
set yrange [0.2:1]
set ylabel 'c^2_{imax}'
set y2label 'PMF (kcal/mol)'
set y2range [-20:1]
set multiplot
set pm3d map interpolate 10,10
set view map
set isosamples 10  #increase resolution
set palette rgb 33,13,10   #rainbow color scheme

unset colorbox
splot[0:12][0.2:1] 'cisq_rrr_reduced.dat' u 1:2:3  notitle
unset map

plot[0:12] 'final_pmf.dat' u 1:2 w line lt 2 lw 2 notitle axis x1y2
unset multiplot
要提到的一点是,我有两个垂直的y轴,正如脚本中的“轴x1y2”所建议的那样。问题是,运行此脚本后,我发现第二个绘图与第一个绘图不正确对齐。换句话说,它们有不同的大小,它们的重叠似乎有问题。它看起来像本页第一个图中描述的问题

但我无法通过使用类似于该页面的脚本来解决此问题


谢谢。

我更熟悉彼此相邻的多个绘图,但有两件事可能会对您有所帮助:

  • multiplot允许对每个图形使用“设置大小”命令(有关更多信息,请参阅“帮助设置大小”)。但是我想如果你说不太常见问题页面上的脚本没有帮助,这可能是不够的
  • 因此,设置边距(请参阅“帮助设置边距”)可能很有用,它可用于在多点打印中更精确地对齐图形。它还经常修复不同长度的数据范围的问题,这些数据范围会导致许多未对齐问题

我建议根本不要使用
pm3d
multiplot
,而是使用
plot…和image
。这样,您就可以使用一个
plot
命令

如果我没有犯任何错误,只需将代码更改为(在
multiplot
之前的所有内容都保持不变):


您可以使用gnuplot的特性,即通过
set table
将等高线数据保存到文件中(请参阅文档和隐式示例)。比如:

...
set table 'contours.dat'
splot[0:12][0.2:1] 'cisq_rrr_reduced.dat' u 1:2:3  notitle
unset table

plot[0:12] 'final_pmf.dat' u 1:2 w line lt 2 lw 2 notitle axis x1y2, \
           'contours.dat' using 1:2

根据您的情况进行调整。

谢谢,@Wrzlprmft。我尝试过这种方法,这种方法没有我上面描述的对齐问题。但是,由于我的数据文件中的数据点分布比较稀疏,我仍然希望使用某种插值,例如pm3d中的“插值”关键字来提高等高线图的分辨率。你知道当我用图像绘图的时候我是怎么做到的吗?我试过“设置isosample”,但没有成功。据我所知,这是不可能的。如果希望Gnuplot进行插值,则必须使用
pm3d
。唯一的替代方法是编写一个小脚本,生成一个插值数据文件,并如上所述打印该文件。还要注意,我永远不会为此类打印插入数据,因为这会混淆数据的实际分辨率。谢谢。我尝试了两个数字的“设置原点0,0”和“设置大小1,1”,但都不起作用。我还尝试让两个数字具有相同的左、右、下和上边距,但这仍然不起作用。你知道有没有更好的办法来设定利润率吗?不知道什么“不起作用”。但是,您可能希望大幅增加边距,以确保它们约束两个图形。有时,如果值很小,则没有明显的效果。将两个图形对齐后,可以减小边距值,直到多点图尽可能大。@user2226358:另一种方法是将所有边距设置为0,
设置原点0.2,0.2
设置大小0.79,0.79
并调整这些值以定位图形,从而调整边距。
...
set table 'contours.dat'
splot[0:12][0.2:1] 'cisq_rrr_reduced.dat' u 1:2:3  notitle
unset table

plot[0:12] 'final_pmf.dat' u 1:2 w line lt 2 lw 2 notitle axis x1y2, \
           'contours.dat' using 1:2