我有以下 gnu 图:
# automobile_input.txt
#
set term png
set output "automobile.png"
#
# Fields in each record are separated by commas.
#
set datafile separator ","
set title "Price versus Curb weight"
set xlabel "Price in dollars"
set ylabel "Curb weight in pounds"
set grid
plot 'x' using 1:2
quit
x 是一个包含数字的文件,例如
1,2
0.5,4
等等
我想对此图进行一些更改。
在图的顶部有“x using 1:2”,我想删除它。
最后,最重要的事情:我想添加另一个文件,y,以相同的格式,它也将绘制在同一个图上,只是具有不同的符号和颜色(而不是红色的加号),例如,蓝色三角形。我更希望优点是圆形。
最佳答案
在绘图线中使用 notitle
省略数据系列标题。添加另一条曲线可以这样完成:
plot 'x' using 1:2 notitle, \
'y' using 1:2 notitle
数据系列点会自动调整。要手动指定格式,您可以使用如下所示的内容进行绘图:
plot 'x' using 1:2 with points pointtype 6 linecolor rgb 'red' title "Data X", \
'y' using 1:2 with points pointtype 8 linecolor rgb 'blue' title "Data Y"
您通常会在网上看到将这些命令缩写为如下的脚本:
plot 'x' w p pt 6 lc rgb 'red' title "Data X", \
'y' w p pt 8 lc rgb 'blue' title "Data Y"
关于plot - 如何改进以下 gnu 图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38668267/