如何在Gnuplot中绘制3D图形横截面上的离散数据

时间:2014-01-17 11:30:00

标签: gnuplot

我想在z = 0的横截面上绘制用stp199inf2.dat写的离散数据,其中还绘制了函数c1和c2。 我现在真的需要帮助。


set multiplot

c1(x,y) = x**2 + y**2 -1 - 0.1*cos(16*atan(x/y))
c2(x,y) = (x-0.5)**2 + (y-0.5)**2 -0.5

C=0.7
set xrange[0:1.2]
set yrange[0:1.2]

set tics font"Times New Roman,12"
set xlabel "f1"
set ylabel "f2"
set xlabel font "Times New Roman, 12"
set ylabel font "Times New Roman, 12"
set key font "Times New Roman, 12"
set key right top

set isosamples 300,300
set contour base
set cntrparam levels discrete  0.0
set nosurface
set size square
set view 0,0,

splot c1(x,y)  lt -1 lw 1 title ""
splot c2(x,y) lt -1 lw 1 title ""
splot c1(x,y) lt 3 lw 2.5 title "True Pareto Front"

splot './gnuplot_plot/stp199inf2.dat' lt 4 ps 3 pt 7 

pause -1

------------------- stp199inf2.dat ----------------------

1.037663 0.042694 0.0
0.071479 1.018838 0.0
0.871717 0.475405 0.0
0.909571 0.456881 0.0
0.996505 0.096337 0.0

1 个答案:

答案 0 :(得分:0)

使用unset surface时,也不会绘制点数。因此,您必须在绘制点之前设置曲面。

您的代码的其他一些评论:

  1. 如果您在一个图中包含所有内容,则应使用带有逗号分隔调用的单个splot命令。
  2. 在这种情况下,您必须使用选项nosurface取消设置前三个图表的曲面。
  3. 您必须使用选项nocontour取消设置点图的轮廓。
  4. 如果您使用set view map代替set view 0,0,则重叠的zticlabels不会是set termoption font"Times New Roman,12" set multiplot c1(x,y) = x**2 + y**2 -1 - 0.1*cos(16*atan(x/y)) c2(x,y) = (x-0.5)**2 + (y-0.5)**2 -0.5 C=0.7 set xrange[0:1.2] set yrange[0:1.2] set xlabel "f1" set ylabel "f2" set key outside set isosamples 300,300 set contour base set cntrparam levels discrete 0.0 set size square set view map splot c1(x,y) lt -1 lw 1 title "" nosurface,\ c2(x,y) lt -1 lw 1 title "" nosurface,\ c1(x,y) lt 3 lw 2.5 title "True Pareto Front" nosurface,\ 'stp199inf2.dat' lt 4 ps 3 pt 7 nocontour title "" unset multiplot 。绘制。
  5. 因此,合理的脚本可能如下所示:

    {{1}}

    4.6.3的输出是:

    enter image description here

    我不确定如何最好地处理轮廓键输入。当我找到答案时,我会更新答案。