-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgnuplotexample1.txt
More file actions
76 lines (65 loc) · 2.79 KB
/
Copy pathgnuplotexample1.txt
File metadata and controls
76 lines (65 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# 画一个函数, 或者多个函数
# 两种方式, 第一种是 plot func with options, 第二种是 set options, plot func
# 核心就是 set XXX
set title 'My first graph'
set xlabel 'Angle, in degrees'
set ylabel 'sin(angle)'
set xrange [-pi:pi]
set xtics ('0' 0, '90' pi/2, '-90' -pi/2, '45' pi/4,'-45' -pi/4,'135' 3*pi/4,'-135' -3*pi/4)
set grid
# help set key
set key top left
set key box
# set key outside vertical
# set size ratio 2
# help plot with
# with <style> { {linestyle | ls <line_style>}
# | {{linetype | lt <line_type>}
# {linewidth | lw <line_width>}
# {linecolor | lc <colorspec>}
# {pointtype | pt <point_type>}
# {pointsize | ps <point_size>}
# {arrowstyle | as <arrowstyle_index>}
# {fill | fs <fillstyle>} {fillcolor | fc <colorspec>}
# {nohidden3d} {nocontours} {nosurface}
# {palette}}
# }
# help smooth
plot sin(x) with linespoints pointtype 5 smooth acsplines, cos(x) t 'cosine' w boxes lt 4
## with w with子句指定样式
## line l 用线画
## point p 用点画
## linespoints lp 用线和点画
## linetype lt 线的样式
## linewidth lw 线的宽度
## pointtype pt 点的样式
## pointsize ps 点的大小
## 1 plot
## 2 同时画多条曲线
## 3 图例
## 4 关于坐标轴
## 5 在图中插入文字
## 6 X轴时间
## 7 在图中添加直线和箭头
## 8 图的大小和位置
## 9 画三维图
## 10 将图形输出到文件
## 11 同时画多个图画
## 13 利用左右两边的y轴分别画图
## 14 插入希腊字母和特殊符号
## 15 画等高线图
## 16 画pm3d图
https://blog.csdn.net/bill_chuang/article/details/18215051
gnuplot中的一些技巧
在图中插入文字
gnuplot> set label ‘sin(x)’ at 0.5,0.5 %在坐标(0.5,0.5)处加入字符串’sin(x)’。
在输出为.ps或.eps文件时,如果在set term 的语句中加入了enhanced选现,则可以插入上下标、希腊字母和特殊符号。上下标的插入和latex中的方法是一样的。
如果要在图中每个点上都添加标签,可以
gnuplot>plot 'file.dat' using 1:2:3 with labels %其中1,2列分别表示横坐标和总坐标值,第三列作为标签添加到每个点上,当然第三列必须时双引号扩起来的字符串,比如
1,2,"1"
3,4,"2"
....
如果第三列是数字,可以用stringcolumn(3)转换
gnuplot>plot 'file.dat' using 1:2:(stringcolumn(3)) with labels
若既想把点画出来,又想在点上添加标签,目前我的做法时分别画,因为with后面labels和<type>不能兼容,这个没有Matlab好,即
gnuplot>plot ‘file.dat’ using 1:2 with points ps 3,plot 'file.dat' using 1:2:3 with labels