[英]Gnuplot - 3D Surface Graph
I am trying to create a 3D surface plot which looks like this: 我正在尝试创建一个如下所示的3D表面图:
Instead of plotting the equation, I am trying to plot my own set of data contained in the data.tsv file in the recommended grid format. 我没有绘制等式,而是尝试以推荐的网格格式绘制data.tsv文件中包含的自己的数据集。
8417 5128 4661
7284 4940 3373
5220 3597 4088
For clarity, The XYZ representation of the above data is: 为了清楚起见,以上数据的XYZ表示为:
rec/s mb/s latency
640000 1024 5220
640000 2048 3597
640000 4096 4088
320000 1024 7284
320000 2048 4940
320000 4096 3373
160000 1024 8417
160000 2048 5128
160000 4096 4661
The gnuplot script that I am using to get the desired output is: 我用来获取所需输出的gnuplot脚本是:
set term postscript eps enhanced color
set output '|ps2pdf - outputfile.pdf'
set bar 1.000000 front
set style circle radius graph 0.02, first 0.00000, 0.00000
set style ellipse size graph 0.05, 0.03, first 0.00000 angle 0 units xy
set style textbox transparent margins 1.0, 1.0 border
unset logscale
set samples 51, 51
set isosamples 21, 21
set style data lines
unset paxis 1 tics
unset paxis 2 tics
unset paxis 3 tics
unset paxis 4 tics
unset paxis 5 tics
unset paxis 6 tics
unset paxis 7 tics
set title "3D gnuplot demo"
set xlabel "X axis"
set xlabel offset character -3, -2, 0 font "" textcolor lt -1 norotate
set xrange [ 160000 : 640000 ] noreverse nowriteback
set ylabel "Y axis"
set ylabel offset character 3, -2, 0 font "" textcolor lt -1 rotate by -270
set yrange [ 1024 : 4096 ] noreverse nowriteback
set zlabel "Z axis"
set zlabel offset character -5, 0, 0 font "" textcolor lt -1 norotate
set paxis 1 range [ * : * ] noreverse nowriteback
set paxis 2 range [ * : * ] noreverse nowriteback
set paxis 3 range [ * : * ] noreverse nowriteback
set paxis 4 range [ * : * ] noreverse nowriteback
set paxis 5 range [ * : * ] noreverse nowriteback
set paxis 6 range [ * : * ] noreverse nowriteback
set paxis 7 range [ * : * ] noreverse nowriteback
set colorbox vertical origin screen 0.9, 0.2, 0 size screen 0.05, 0.6, 0 front noinvert bdefault
x = 0.0
# Last datafile plotted: "$grid"
splot 'data.tsv' using 1:2:3
However, the above script is giving me the following error: 但是,以上脚本给了我以下错误:
"3d.gp", line 37: warning: No usable data in this plot to auto-scale axis range
splot 'data.tsv' using 1:2:3
^
"3d.gp", line 37: All points z value undefined
Format the data.tsv
file like this : 像这样格式化data.tsv
文件:
640000 1024 5220
640000 2048 3597
640000 4096 4088
320000 1024 7284
320000 2048 4940
320000 4096 3373
160000 1024 8417
160000 2048 5128
160000 4096 4661
and plot the data with 并用
splot 'data.tsv' using 1:2:3 w l
I did a sucessful test just with that last gnuplot command... if you want something more fancy, I can try to help 我仅使用最后一个gnuplot命令进行了成功的测试...如果您想要更多的奇特功能,我可以尝试提供帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.