gnuplot进阶

(1)图例样式(test)
样式

(2)希腊符号:
一般只能在ps和eps图中,且必须指定enhanced选项。
gnuplot> set terminal postscript enhanced
然后希腊字母就可以通过{/Symbol a}输入。例如
gnuplot> set label ‘{/Symbol a}’
这里写图片描述
参考资料

(3)多图:

gnuplot> set multiplot   #设置为多图模式

multiplot> set origin 0.0,0.0#设置第一个图原点
multiplot> set size 0.5,0.5#设置第一个图尺寸
multiplot> plot sin(x)  #画第一个图(右下)

multiplot> set origin 0.0,0.5
multiplot> set size 0.5,0.5
multiplot> plot sqrt(x**3)  #画第二个图(右上)

multiplot> set origin 0.5, 0.0 
multiplot> set size 0.5,0.5  
multiplot> plot cos(x)  #画第三个图(左下)

multiplot> set origin 0.5, 0.5 
multiplot> set size 0.5,0.5  

多图

(4)箭头

set xr [-6.5:6.5]  
set yr [-1:1]  
plot sin(x)  
set arrow from -2,0.6 to 0,1 ls 6
#从点(-2,0.6)指向(0,1)

箭头

(5)蜡烛图(Candlesticks)
蜡烛图,candlesticks 可用于经济数据(股票价格),或者为统计数据绘制统计须盒图(a box-andwhisker plot )。
矩形中心横坐标为 x。矩形高度由开盘价格和收盘价格确定。高低须线的值为最高值和最低值。矩形宽度由 set boxwidth 控制。
candle 是 candlesticks 的简写,没有歧义就可以。也可以写成can[dlesticks],方括号内可以省略。
默认生成的蜡烛图须线结尾没有横线,plot 语句使用 whiskerbars 关键字将产生这个横线。当open>close 矩形被填充。open

x y_open y_low y_high y_close

2 20 18 23 19
5 18 16 24 21
8 25 23 28 27

set xrange [1:10]
set yr [15:30]
plot '路径/candlesticks.txt' using 1:2:3:4:5 with candle t "Candlesticks"

蜡烛图1

将最后一句改为:

plot 'E:/gnuplot/candlesticks.txt' using 1:2:3:4:5 with candle t "Candlesticks" whiskerbars

蜡烛图2

(6)用Image画矩阵:

gnuplot> plot '-' matrix with image
input data ('e' ends) > 5 3 2 0 1
input data ('e' ends) > 2 4 1 1 5
input data ('e' ends) > 0 3 4 2 0
input data ('e' ends) > 5 0 0 4 2
input data ('e' ends) > e
input data ('e' ends) > e

Image

(7)3D画图–splot

gnuplot> f(x,y) = x**2 + y**2 + x*y
gnuplot> splot f(x,y) with line

3d1

gnuplot> splot f(x,y) with pm3d

pm3d

splot 命令在使用 set view map 命令后将垂直映射图形到 xy 平面

gnuplot> set view map
gnuplot> replot

view

(8)地图

set dummy u,v
set angles degrees
set parametric
set view 60, 136, 1.22, 1.26
set samples 64,64
set isosamples 13,13
set mapping spherical
unset xtics
unset ytics
unset ztics
set border 0
set title "Labels colored by GeV plotted in spherical coordinate system"
set urange [ -90.0000 : 90.0000 ] noreverse nowriteback
set vrange [ 0.00000 : 360.000 ] noreverse nowriteback
set cblabel "GeV"
set cbrange [0:8]
set colorb vert user size 0.02, 0.75
unset hidden
splot cos(u)*cos(v),cos(u)*sin(v),sin(u) notitle with lines lt 5, 
      'world.dat' notitle with lines lt 2, 
      'srl.dat' using 3:2:(1):1:4 with labels notitle point pt 6 lw .1 left offset 1,0 font "Helvetica,7" tc pal

地图

gnuplot官网示例

不积跬步,无以至千里;不积小流,无以成江海。
原文地址:https://www.cnblogs.com/xiaocai-ios/p/7779797.html