GnuPlot 使用教程

Windows下载地址
一直下一步,注意安装目录。

设置生成图片形状

1、set size 0.8 , 0.8

设置生成的图片大小

2、set xrange [-5:5]

设置x轴坐标的取值范围,yrange 与 xrange 对应

3、set xtics 1

设置x轴坐标的刻度,显示数字的刻度,主刻度

4、set mxtics 0.5

主刻度之间被分割的份数

5、设置图例

图例设置边框
set key box
改变图例显示位置
set key center at 10,10
将图例文字与线条左右互换
set key reverse
为图例边框设置宽度
set key width 1

replot

刷新图片

设置线条

1、plot sin(x) with line linetype 3 linewith 2

或者plot sin(x) w l lt 3 lw 2
意思是:用线画,线的类型(包括颜色和点的类型)是3,线的宽度是2,对函数sin(x)作图

2、plot sin(x) w p pt 3 ps 2

用点画,点的类型是2

3、多数据

plot “C:\Users\HP\Desktop\precipitation.dat” using 1:2 w lp pt 5 title “storm2” , “C:\Us
ers\HP\Desktop\precipitation.dat” using 1:3 w lp pt 7 title “storm1”

using 1:2 表示 使用第一列为横轴,第二列为纵轴。
多个数据用逗号隔开
数据文后缀名为dat

pointtype 4

规定了标记点的类型。不同数字对应的标记点如下

数字标记
0
1+
2×
3
4
5
6
7
8
9
10
11
12
13
14空心倒正五边形
15实心倒正五边形

输入 test命令
在这里插入图片描述

lt 1

linetype 1 ,规定了连线的类型,-1对应黑虚线,0对应黑虚线,大于0的整数对应不同颜色的实线。1为紫色,2为绿色,3为蓝色,4为橙色、5为黄色、6为深蓝色、7为红色、8为黑色,大于8的数字对应的颜色与其对8的余数对应的颜色相同。

set label 1 “hello first” at 5,350

设置位子在图中的位置
set label 1 "stage 1 " at 7,90

定制一条网格线

set grid 
set style line 100 lt 1 lc rgb "black" lw 1
set arrow 100 from 18,0 to 18,500 nohead ls 100 front 

定制箭头

设置箭头
set arrow 1 from 80,180 to 40,90 empty size 20,15,60 lw 2
设置点
set label 1 at 80,180 point pt 7 ps 1.5 lc rgb “black”
set label 2 “30s” at 75,195

绘制柱状图

set size 0.8,0.8
set yrange [0:600] 
set ytics 50
set xtics (4,6,8)
set grid
set key box
set xlabel 'Cluster size'
set ylabel 'System throughput (tuple/s)'
set style histogram clustered gap 2 
set style fill pattern border -1
plot "C:\\Users\\HP\\Desktop\\experience_data\\cluster_size.dat" using 2 title "Dra-WordCount " with histogram ls -1 fill pattern 1 ,\
"C:\\Users\\HP\\Desktop\\experience_data\\cluster_size.dat" using 3 title "Dra-Top_N" with histogram ls -1 fill pattern 7 , \
"C:\\Users\\HP\\Desktop\\experience_data\\cluster_size.dat" using 4 title "Storm" with histogram ls -1 fill pattern 4

例子

set size 0.8,0.8
set mxtics 2
set mytics 2
set xlabel 'Running time(s)'
set ylabel 'Execute Latency(ms)'
set ylabel 'Process Latency(ms)'
plot "/mnt/hgfs/Ubuntu64/paper_executeLatency.txt" title "Storm" with linespoints lt -1 lw 1 pt 8 ps 1.5,"/mnt/hgfs/Ubuntu64/paper_executeLatency_a.txt" title "De-Stream" w lp lt -1 lw 1 pt 4 ps 1
plot "/mnt/hgfs/Ubuntu64/paper_processLatency.txt" title "Storm" with linespoints lt -1 lw 1 pt 8 ps 1.5,"/mnt/hgfs/Ubuntu64/paper_processLatency_a.txt" title "De-Stream" w lp lt -1 lw 1 pt 4 ps 1
set size 0.8,0.8
set mxtics 2
set mytics 2
set yrange [0:500] 
set grid
set xlabel 'Running time(s)'
set ylabel 'Execute Latency(ms)'
set ylabel 'Process Latency(ms)'
plot "C:\\Users\\HP\\Desktop\\precipitation.dat" title "Storm" with lp lt -1 lw 1 pt 8 ps 1.5
  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值