首页 > 解决方案 > 如何在 gnuplot 中将 yerror 或 yerrorbar 与linespoints 和其他参数一起使用?

问题描述

我可以使用常规平均值绘制图表。然后我为每个平均值添加了一个新列,即标准偏差。我的数据是这样的:

time,throughputINmean,throughputINstddev,throughputOUTmean,throughputOUTstddev,latency50mean,latency50stddev,latency99mean,latency99stddev
,0,0,0,0,0,0,0,0
"2020-06-08 09:43:45",0,0,0,0,0,0,0.862083,0.195044
"2020-06-08 09:44:00",1385.41,155.736,1385.41,155.737,0,0,0,0
"2020-06-08 09:44:15",1878.42,28.5521,1878.42,28.5521,0,0,0,0
"2020-06-08 09:44:30",2271.56,29.6025,2271.56,29.608,0,0,0,0
"2020-06-08 09:44:45",2642.69,49.2259,2642.69,49.2284,0,0,0,0
"2020-06-08 09:45:00",1627.49,99.2306,1627.49,99.232,0,0,0,0
"2020-06-08 09:45:15",1498.38,44.8282,1498.38,44.8282,0,0,0,0
"2020-06-08 09:45:30",1462.4,18.8785,1462.39,18.8717,0,0,0,0

我在 gnuplot 中使用此脚本进行绘图:

plot t=0 "throughput-vs-latency-50K-8combiners-8reducers-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000) skip 2 notitle with linespoints ls 1 axis x1y1 \
, t=0 "throughput-vs-latency-50K-8combiners-8reducers-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(4)/1000) skip 2 notitle with linespoints ls 2 axis x1y1 \
, t=0 "throughput-vs-latency-50K-8combiners-8reducers-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(6)/1000) skip 2 notitle with linespoints ls 3 axis x1y2 \
, t=0 "throughput-vs-latency-50K-8combiners-8reducers-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(8)/1000) skip 2 notitle with linespoints ls 4 axis x1y2 \

然后我只是在最后一行添加了yerror参数和有关这些值的列。最后一行变成了这样:

, t=0 "throughput-vs-latency-50K-8combiners-8reducers-all.csv" u (t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(8)/1000):((column(8)/1000)-(column(9)/1000)):((column(8)/1000)+(column(9)/1000)) skip 2 notitle with yerror linespoints ls 4 axis x1y2

Gnuplot抱怨这不是一个公认的令牌。我也进行了测试,yerrorbars我得到了同样的错误。

标签: gnuplot

解决方案


“with yerrorlines”、“with yerrorbars”和“withlinespoints”是三种不同的绘图风格。您不能同时选择两个。因此,如果要将绘图切换为“yerrorlines”,则必须删除关键字“linespoints”。


推荐阅读