linux plot 文件_【Linux】gnuplot命令大全

在linux命令提示符下运行gnuplot命令启动,输入quit或q或exit退出。

plot命令

gnuplot> plot sin(x) with line linetype 3 linewidth 2 或

gnuplot> plot sin(x) w l lt 3 lw 2 %用线画,线的类型(包括颜色与虚线的类型)是3,线的宽度是2,对函数sin(x)作图

gnuplot> plot sin(x) with point pointtype 3 pointsize 2 或

gnuplot> plot sin(x) w p pt 3 ps 2 %用点画,点的类型(包括颜色与点的类型)是3,点的大小是2

gnuplot> plot sin(x) title ‘f(x)’ w lp lt 3 lw 2 pt 3 ps 2 %同时用点和线画,这里title ‘f(x)’表示图例上标’f(x)’,如果不用则用默认选项

gnuplot> plot sin(x) %此时所有选项均用默认值。如果缺某一项则将用默认值

gnuplot> plot ‘a.dat’ u 2:3 w l lt 3 lw 2 %利用数据文件a.dat中的第二和第三列作图

顺便提一下,如这里最前面的两个例子所示,在gnuplot中,如果某两个词,按字母先后顺序,前面某几个字母相同,后面的不同,那么只要写到第一个不同的字母就可以了。如with,由于没有其它以w开头的词,因此可以用 w 代替,line也可以用l 代替。

2、同时画多条曲线

gnuplot> plot sin(x) title ‘sin(x)’ w l lt 1 lw 2, cos(x) title ‘cos(x)’ w l lt 2 lw 2 %两条曲线是用逗号隔开的。画多条曲线时,各曲线间均用逗号隔开就可以了。

以上例子中是对函数作图,如果对数据文件作图,将函数名称换为数据文件名即可,但要用单引号引起来。

3、关于图例的位置

默认位置在右上方。

gnuplot> set key left %放在左边,有left 和right两个选项

gnuplot> set key bottom %放在下边,只有这一个选项;默认在上边

gnuplot> set key outside %放在外边,但只能在右面的外边,以上三个选项可以进行组合。如:

gnuplot> set key left bottom %表示左下边,还可以直接用坐标精确表示图例的位置,如

gnuplot> set key 0.5,0.6 %将图例放在0.5,0.6的位置处

4、关于坐标轴

gnuplot> set xlabel ‘x’ %x轴标为‘x’

gnuplot> set ylabel ‘y’ %y轴标为’y’

gnuplot> set ylabel ‘DOS’ tc lt 3 %其中的tc lt 3表示’DOS’的颜色用第三种颜色。

gnuplot> set xtics 1.0 %x轴的主刻度的

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值