gpt4 book ai didi

gnuplot - 从 gnuplot 中的一个数据集中绘制 2 个系列

转载 作者:行者123 更新时间:2023-12-01 11:57:10 26 4
gpt4 key购买 nike

我有以下数据文件:

Time;Server;Hits
2011.05.05 12:00:01;Server1;12
2011.05.05 12:00:01;Server2;10
2011.05.05 12:00:02;Server1;2
2011.05.05 12:00:02;Server2;4

到目前为止,我已经想出了以下 gnuplot 脚本:

set datafile separator ";"
set autoscale
set xdata time
set timefmt "%Y.%m.%d %H:%M:%S"
set xtics rotate
set term png
set output "hits.png"
set style fill solid 0.5
plot "hits.log" using 1:3 title 'Hits'

但是那个将来自两个服务器的数据绘制在同一个图表上作为一个数据系列。如何让 gnuplot 显示 2 个数据系列:每个服务器一个?

最佳答案

我自己找到了解决方案:

plot "hits.log" using 1:(stringcolumn(2) eq "Server1" ? $3 : 1/0) title 'Server1' with lines,\
"hits.log" using 1:(stringcolumn(2) eq "Server2" ? $3 : 1/0) title 'Server2' with lines

关于gnuplot - 从 gnuplot 中的一个数据集中绘制 2 个系列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5896697/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com