Gnuplot学习笔记

 

#1设置x、y坐标范围

set xrange[-5:5] yrange[-2:2]

#也可以这样:

plot [-5:5] [-2:2] sin(x)

 

#2设置坐标轴名称、标题

set xlabel 'xlabel' ; 

set ylabel 'ylabel' ;

set title 'title' ;

 

#3为曲线设置标题

plot sin(x) title 'y=sin(x)',x title 'y=x'

#设置标题的位置:

set key x y 

set key default

#不设置标题:

unset key

 

#4网格 

set grid

 

#5设置输出

set terminal jpeg

set output 'sinx.jpg'

set size m,n //m,n为放大(缩小)倍数

set terminal windows //简写 se t w

 

#6三维绘图

splot x*y

 

#7运算符

f(x)=x?>=x?-x:x;plot f(x)

 

#8自定义函数

f(x)=x*x; plot f(x)

p(x,y)=x*x+y*y; splot p(x,y)

 

#9文件绘图

#cat file.dat:

10 0.781 0.857 0.963

20 0.891 1.053 1.023

30 0.950 1.037 1.025

40 0.984 0.999 1.014

50 1.013 0.998 1.018

60 1.000 1.000 1.000 

#

cd 'file-dir' ; pwd

#将使用第前两列作为x、y坐标数据:

plot 'file.dat'

plot 'file.dat' with lines/linespoint

#使用第一列与第三列数据绘图:

plot 'file.dat' using 1:3 with linespoint

#使用第一列与第三列的二分之一数据绘图:

plot 'file.dat' using 1:($3/2) with linespoint

#使用函数操作数据:

plot 'file.dat' using 1:(sin($2)) with linespoint

 

#10脚本功能

load file.plt

call file.plt

#call只是比load多个参数读取,$#为参数个数,$n为参数引用。

如:cat test.plt :

set ter jpeg

set out 'out.jpg'

plot x**3 title 'x^3', x*x title 'x^2'

#调用:

call 'test.plt'

#这样也行:

$cat test.plt | gnuplot 

 

转载于:https://www.cnblogs.com/qydw000/p/5065143.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值