如何从gnuplot中的数据设置点类型?
gnuplot脚本:
set terminal pngcairo size 640,480
set output "points.png"
set style data points
set auto x
set autoscale x
unset colorbox
plot 'test.data' using 2:1 with points notitle
Run Code Online (Sandbox Code Playgroud)
测试数据
32 35 8
34 34 6
36 28 1
34 32 2
28 30 7
38 30 9
34 29 2
35 36 9
39 34 3
31 33 9
28 31 6
35 30 5
33 41 4
32 37 3
Run Code Online (Sandbox Code Playgroud)
如何从3列获得点类型?
plot 'gnuplot.data' using 2:1 with points pt (:3) notitle // error
Run Code Online (Sandbox Code Playgroud)
抽象示例:

需要:

gnuplot版本4.6补丁级别4
没有选项以选择从基于列的数据文件中的点类型(相当于linecolor variable,pointsize variable或arrowstyle variable).基本上你有两个选择:
迭代所有可能的点类型(stats如果这应该是可变的,可以提取),并且对于每个数字,只绘制与当前点类型匹配的点:
stats 'test.data' using 3 nooutput
unset key
set style data points
plot for [i=STATS_min:STATS_max] 'test.data' using 2:($3 == i ? $1 : 1/0) lt 1 pt i ps 2
Run Code Online (Sandbox Code Playgroud)
使用labels绘图样式和一系列unicode点符号,您可以使用第三列中的值作为索引从中选择.(使用例如http://www.shapecatcher.com或http://decodeunicode.org/en/geometric_shapes查找合适的符号)
unset key
set encoding utf8
symbol(z) = "•?+??????"[int(z):int(z)]
plot 'test.data' using 2:1:(symbol($3)) with labels textcolor lt 1
Run Code Online (Sandbox Code Playgroud)