与 gnuplot 战斗以使箱图工作

Fighting with gnuplot to get boxes plot working

我有一个包含以下列的数据文件:

Year:Month    Data1    Data2   Data3

对于给定的日期范围(例如,去年),我想使用方框进行绘图,因此每个月都有 3 个并排的方框(每个占整个月宽度的 1/3),每个方框一个对于数据 1、数据 2 和数据 3。但是我不能让 gnuplot 玩。这是我尝试过的:

set xdata time
set timefmt "%Y:%m"
set style fill solid
set boxwidth 890000 absolute # Third of a month in seconds, approx
plot ["2020:02" : "2021:02"][0:] "file.dat" using 1:2 with boxes, "file.dat" using ( - 890000):3 with boxes, "file.dat" using ( + 890000):4 with boxes

恐怕我误解了“使用 1:2”和“使用 ($1 + ...):2”之间的区别,但不确定如何 - 结果图具有正确的 Y scale/values,但 X 刻度到处都是。

using () 不遵守时间格式。请尝试 using (timecolumn(1, "%Y:%m"))

plot ["2020:02" : "2021:02"][0:] "file.dat" using 1:2 with boxes, \
                                 "file.dat" using (timecolumn(1, "%Y:%m")-890000):3 with boxes, \
                                 "file.dat" using (timecolumn(1, "%Y:%m")+890000):4 with boxes