由于必须使用旧版本的gnuplot 4.0,因此我发现圆形样式不可用。谁能建议我如何从像这样的数据中绘制大小不同的圆:
x y size
0.000000 -18.595474 2.752
0.154186 -18.574680 0.752
0.308371 -18.513723 0.752
0.462557 -18.416941 3.753
0.616743 -18.291512 1.754
0.770928 -18.147374 2.755
0.925114 -17.996800 2.757
1.079300 -17.853565 0.759
1.233485 -17.731370 4.761
1.387671 -17.642539 0.763
1.541857 -17.605154 1.763
我使用这样的命令,但它告诉我一个错误,即未定义的变量:变量
plot "data0" u 1:2:3 with points pt 7 lt 1 ps variable title 'total'
非常感谢!
哦,我会说这并不简单。 gnuplot的更高版本引入了此功能(使用数据中的可变点大小)和许多其他有用的功能(循环,plot命令中的表达式,数组等)来创建“简单”的解决方法。
在gnuplot 5.2.6中,这很可能是
plot 'Data.dat' u 1:2:3 w p ps var
但是,对于gnuplot 4.0,您可以使用]创建一个奇怪的解决方法
multiplot
reread
子例程使用Windows终端在Win 7上使用gnuplot 4.0测试。也许我忽略了一种更简单的方法,但是使用gnuplot 4.0时,您的功能非常有限。您必须有充分的理由不想或无法更新到较新的版本。
数据:
tbCirclesV4.dat
# x y size 0.000000 -18.595474 2.752 0.154186 -18.574680 0.752 0.308371 -18.513723 0.752 0.462557 -18.416941 3.753 0.616743 -18.291512 1.754 0.770928 -18.147374 2.755 0.925114 -17.996800 2.757 1.079300 -17.853565 0.759 1.233485 -17.731370 4.761 1.387671 -17.642539 0.763 1.541857 -17.605154 1.763 0.000000 0.000000 0.000
主程序:
tbCirclesV4.plt
### mimic "plot 1:2:3 w p ps var" in gnuplot V4.0 reset set term windows set multiplot set xrange[-0.1:1.6] set yrange[-19:-17] i=0 Max=11 f(x) = a*x + b load 'tbCirclesV4Loop.plt' unset multiplot ### end of code
子例程:
tbCirclesV4Loop.plt
### sub-routine a=1 b=1 fit [*:*][*:*] f(x) 'tbCirclesV4.dat' every ::i::i+1 u 0:3 via a,b print "Size: ", i, b # use pointsize b*2 to enlarge the circles a little plot 'tbCirclesV4.dat' u 1:2 every ::i::i w lp pt 8 ps b*2 lt i+1 notitle i=i+1 if (i<Max) reread ### end of sub-routine
结果: