如何使Gnuplot绘图了解X轴数据不在数据文件中? [英] How to make splot from Gnuplot understand that the X axis data is not in the data file?

查看:48
本文介绍了如何使Gnuplot绘图了解X轴数据不在数据文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Gnuplot中的splot创建3D图表.我的数据文件只有X(时间)和Y(吞吐量)值,但是我将使用同一splot中的多个数据文件以3D方式创建它.因此,最后,X将是datafile-1,datafile-2,datafile-3等.Y是时间,Z是吞吐量.

I am trying to use splot from Gnuplot to create a 3D chart. My data file has only the X (time) and Y (throughput) values but I will use multiple data files in the same splot to create it in a 3D fashion. So, in the end, X would be datafile-1, datafile-2, datafile-3, etc. Y would be the time, and Z would be the throughput.

问题是X轴不在文件中.它实际上是一个不同的文件.而且我认为splot正在理解数据已放置在文件中.如何配置splot以了解要为不同文件固定X轴?这是我当前的情节,带有最少的运行脚本和文件:

The problem is that the X axis is not in the files. It is actually a different file. And I think that splot is understanding that the data is placed on the file. How should I configure splot to understand that I want the X axis fixed for different files? Here is my current plot with a minimal running script and files:

#!/usr/bin/gnuplot

reset session

set style line 1 lc rgb '#3274D9' lt 1 lw 1.0 ps 0.4 pt 2 pi 15 # auto-combiner input    throughput - 8combines.8reducers

set style line 9 lc rgb '#3274D9' lt 1 lw 1.0 ps 0.4 pt 1 pi 15 # auto-combiner input    throughput - 16combines.16reducers

set term pdfcairo size 5.0in,3.5in
set pointintervalbox 0
set datafile separator ','
set output "efficiency-throughput-networkbuffer-TaxiRideNYC-500K-merged-3D.pdf"
set grid
myTimeFmt = "%Y-%m-%d %H:%M:%S"
set key under center maxrows 1 horizontal
set key font ",9"

set xlabel "different topologies" font ",9" rotate by -8 right offset 10,-1,0
set xrange [0:3]
set xtics 0, 1 font ",8"
x0 = 0
x1 = 1
x3 = 2
x4 = 3

set ylabel "time (hour:minute)" font ",9" offset 1,0,0
set format y "%tH:%tM" time
set ytics font ",8" offset 0,0,0
set yrange [0:5400]

set zlabel "Throughput (K rec/sec)" font ",9" rotate by 90 right offset 3,0,0
set zrange [0:7]
set ztics nomirror font ",10"

splot t=0 "throughput-vs-networkbuffer-500K-8combiners-8reducers-all.csv" u x0:(column(2)/1000):(t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0) skip 2 title "auto-combiner input throughput (8:8)" with linespoints ls 1 \
, t=0 "throughput-vs-networkbuffer-500K-16combiners-16reducers-all.csv" u x1:(column(2)/1000):(t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0) skip 2 title "auto-combiner input throughput (16:16)" with linespoints ls 9 \

数据文件throughput-vs-networkbuffer-500K-8combiners-8reducers-all.csv:

time,throughputINmean,throughputINstddev,throughputOUTmean,throughputOUTstddev,outPoolAvgMean,outPoolAvgStddev,outPool99thMean,outPool99thStddev
,0,0,0,0,0,0,0,0
"2020-06-07 23:45:00",1040.88,283.444,1040.88,283.439,79.1667,14.7314,77,16.2635
"2020-06-07 23:45:15",1578.69,108.016,1578.69,108.02,100,0,100,0
"2020-06-07 23:45:30",1853.13,296.748,1853.13,296.756,100,0,100,0
"2020-06-07 23:45:45",2094.84,470.787,2094.84,470.796,100,0,100,0
"2020-06-07 23:46:00",1775.97,249.804,1775.95,249.833,99.8264,0.245523,100,0
"2020-06-07 23:46:15",1459.78,24.1722,1459.76,24.2096,100,0,100,0
"2020-06-07 23:46:30",1429.39,7.10249,1429.37,7.12607,100,0,100,0
"2020-06-07 23:46:45",1425.87,18.5822,1425.84,18.6244,100,0,100,0
"2020-06-07 23:47:00",1415.67,0.0658002,1415.64,0.0481225,100,0,100,0
"2020-06-07 23:47:15",1443.3,3.15546,1443.29,3.15743,100,0,100,0
"2020-06-07 23:47:30",1439.04,0.594166,1439.02,0.60988,100,0,100,0
"2020-06-07 23:47:45",1441.54,13.7807,1441.52,13.7788,100,0,100,0
"2020-06-07 23:48:00",1433.19,12.0817,1433.16,12.1092,100,0,100,0
"2020-06-07 23:48:15",1425.33,0.860313,1425.29,0.897633,100,0,100,0
"2020-06-07 23:48:30",1419.75,19.4022,1419.71,19.4307,100,0,100,0
"2020-06-07 23:48:45",1406.29,32.193,1406.24,32.2313,100,0,100,0
"2020-06-07 23:49:00",1423.24,0.771925,1423.19,0.78371,99.6528,0.245523,100,0
"2020-06-07 23:49:15",1420.64,7.01607,1420.56,7.0092,100,0,100,0
"2020-06-07 23:49:30",1411.63,10.9091,1411.56,10.9287,100,0,100,0
"2020-06-07 23:49:45",1411.94,17.4695,1411.86,17.4822,100,0,100,0
"2020-06-07 23:50:00",1408.83,9.79343,1408.75,9.84253,100,0,100,0
"2020-06-07 23:50:15",1413.76,35.4693,1413.69,35.5449,100,0,100,0
"2020-06-07 23:50:30",1432.11,8.61099,1431.98,8.73375,100,0,100,0
"2020-06-07 23:50:45",1436.48,34.7072,1436.34,34.881,100,0,100,0

和数据文件throughput-vs-networkbuffer-500K-16combiners-16reducers-all.csv:

time,throughputINmean,throughputINstddev,throughputOUTmean,throughputOUTstddev,outPoolAvgMean,outPoolAvgStddev,outPool99thMean,outPool99thStddev
,0,0,0,0,0,0,0,0
"2020-05-28 21:59:00",636.815,544.766,636.815,544.766,60,28.2843,60,28.2843
"2020-05-28 21:59:15",1021.11,247.18,1021.13,247.162,78.8542,14.9524,83.6667,11.5494
"2020-05-28 21:59:30",1415.11,41.2229,1415.1,41.2258,69.6875,21.4342,84.3333,11.078
"2020-05-28 21:59:45",1815.02,324.306,1815.02,324.306,90.4167,6.77644,91.0417,6.3345
"2020-05-28 22:00:00",2051.02,481.214,2051.02,481.218,92.2917,5.45062,97.5,1.76777
"2020-05-28 22:00:15",2003.74,446.739,2003.73,446.748,100,0,100,0
"2020-05-28 22:00:30",1844.27,342.101,1844.26,342.104,100,0,100,0
"2020-05-28 22:00:45",1672.59,222.094,1672.56,222.091,100,0,100,0
"2020-05-28 22:01:00",1489.64,98.2898,1489.64,98.2967,100,0,100,0
"2020-05-28 22:01:15",1396.23,0.577471,1396.21,0.560284,100,0,100,0
"2020-05-28 22:01:30",1379.1,1.3823,1379.09,1.37542,100,0,100,0
"2020-05-28 22:01:45",1374.07,17.6728,1374.08,17.6885,100,0,100,0
"2020-05-28 22:02:00",1383.45,33.6386,1383.44,33.647,100,0,100,0
"2020-05-28 22:02:15",1357.17,19.0992,1357.16,19.1115,100,0,100,0
"2020-05-28 22:02:30",1360.52,5.2483,1360.5,5.23259,100,0,100,0
"2020-05-28 22:02:45",1372.18,22.3451,1372.17,22.3279,100,0,100,0
"2020-05-28 22:03:00",1374.21,5.27384,1374.2,5.26009,100,0,100,0
"2020-05-28 22:03:15",1365.91,8.53979,1365.89,8.54322,100,0,100,0

推荐答案

我可以使用Gnuplot中的函数来实现它.我正在使用与上述相同的数据文件,此Gnuplot脚本以及X轴的功能P(x)=x:

I could make it using functions in Gnuplot. I am using the same data files above, this Gnuplot script, and the function P(x)=x for the X axis:

#!/usr/bin/gnuplot

reset session

set style line 1 lc rgb '#3274D9' lt 1 lw 1.0 ps 0.4 pt 2 pi 15 # auto-combiner input    throughput - 8combines.8reducers

set style line 9 lc rgb '#3274D9' lt 1 lw 1.0 ps 0.4 pt 1 pi 15 # auto-combiner input    throughput - 16combines.16reducers

set term pdfcairo size 5.0in,3.5in
set pointintervalbox 0
set datafile separator ','
set output "efficiency-throughput-networkbuffer-TaxiRideNYC-500K-merged-3D.pdf"
set border 127

set xyplane at 1
set grid
#set grid x y z vertical
#set grid lt 1 lw 0.75 lc "grey"
myTimeFmt = "%Y-%m-%d %H:%M:%S"
set key under center maxrows 1 horizontal
set key font ",9"

set xlabel "different topologies" font ",9" rotate by -8 right offset 10,-1,0
set xrange [0:3]
set xtics 0, 1 mirror font ",8"
P(x)=x

set ylabel "time (hour:minute)" font ",9" offset 1,0,0
set format y "%tH:%tM" time
set ytics mirror font ",8" offset 0,0,0
set yrange [0:5400]

set zlabel "Throughput (K rec/sec)" font ",9" rotate by 90 right offset 3,0,0
set zrange [0:7]
set ztics mirror font ",9"
set ticslevel 0 # We need this, in order to shift the 0 of the z axis

splot t=0 "throughput-vs-networkbuffer-500K-8combiners-8reducers-all.csv" u (P(0)):(t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000) skip 2 title "auto-combiner input throughput (8:8)" with linespoints ls 1 \
, t=0 "throughput-vs-networkbuffer-500K-16combiners-16reducers-all.csv" u (P(1)):(t==0?(t0=timecolumn(1,myTimeFmt),t=1):NaN, timecolumn(1,myTimeFmt)-t0):(column(2)/1000) skip 2 title "auto-combiner input throughput (16:16)" with linespoints ls 9 \

这篇关于如何使Gnuplot绘图了解X轴数据不在数据文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆