

gnuplot 学习小计4
source link: https://blog.csdn.net/yanxiangtianji/article/details/8874174
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

本次要点:
用同一个文件画多条曲线。
replot命令,使用相同文件的渐变做法,双纵坐标。
1,使用相同文件
如果在一条绘制命令中使用逗号绘制多条曲线,那么按照标准语法,我们是需要每次都指定绘图所使用的文件的。然而实际使用中在一条绘图命令中绘制的多挑曲线往往都是来自同一个文件,因此gnuplot规定:在绘制非第一条曲线时可以使用两个单引号来简略表示文件路径,它表示使用上一条绘制命令中使用的文件。
另外,这个特性还不止可以用在逗号隔开的多个子绘制语句,还可以用于多个plot命令之间,replot命令。
plot 'vtb_s600_12.txt' using 2:3 w l
replot '' using 2:($4/3) w l
或
plot 'vtb_s600_12.txt' using 2:3 w l, '' using 2:($4/3) w l
本质上可以理解为,每次我们使用“ ‘xxxx’ ”指定数据文件,就修改了当前的默认文件。而“ '' ”是使用默认文件的意思。
2,replot命令
3,双纵坐标
set ylabel "volume"
set y2label "travel time"
set y2tics
set ytics nomirror
plot 'vtb_s600_12.txt' u 2:3 w l axis x1y1 t "average volume", '' u 2:4 w l axis x1y2 t "average travel time"
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK