【问题标题】:Plot contours from one graph into another in Gnuplot在 Gnuplot 中将一个图形的等高线绘制到另一个图形中
【发布时间】:2016-01-05 19:09:52
【问题描述】:

我有一个包含四列 X Y Z1 Z2 的数据文件,我想为每个 Z 创建一个单独的颜色图,但将等高线从第一个也绘制到第二个。

首先我为 Z1 和轮廓文件创建一个绘图

set terminal "pdfcairo" enhanced dashed size 5,5
set output "Output1.pdf"

set pm3d 
unset surface
set view map
set contour
set cntrparam levels discrete 1.45,1.50

set table 'DATAFILE.contourZ1'
splot 'DATAFILE' using 1:2:3 notitle with lines
unset table

splot 'DATAFILE' using 1:2:3 notitle with lines

unset output

这给了我沿着 Z1=1.45 和 1.50 的两条等高线的颜色图。到目前为止,一切都很好。要将轮廓加载到我尝试的第二个图中

splot 'DATAFILE' using 1:2:4 notitle with lines,\
    'DATAFILE.contourZ1' using 1:2:3 notitle with lines

但这只会给我 Z2 的颜色图,没有任何等高线。

有谁知道,我怎么能做到这一点?如果不能像我尝试过的那样简单,我也愿意接受其他方式:)

非常感谢!

【问题讨论】:

    标签: gnuplot contour


    【解决方案1】:

    您必须在保存表格文件之前unset pm3d,以便获得一个仅包含等高线点的文件。

    然后,如果您想绘制 pm3d 线,您可能需要使用 set pm3d explicitsplot "contour.txt" with lines, "data" with pm3d

    【讨论】:

    • 感谢您的回答。不幸的是,它不起作用。我收到了warning: Can't use pm3d for 2d plots 的消息,结果图只显示了等高线。
    • 像魅力一样工作!非常感谢。对于其他想要尝试这个的人,我建议切换“contour.txt”和“data”的顺序,以确保轮廓位于颜色图的前面。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多