使用 Gnuplot 5.2 和 5.4.5 绘制时间序列数据时,绘制的线与左边缘和右边缘不相交
如果我从 CSV 文件末尾删除几行数据,情况就会好起来
如果我删除更多,线条将按照我想要的方式从左边缘和右边缘开始和结束。
剧情文件:
set title "Sales"
set datafile separator ","
set xdata time
set timefmt "%Y-%m-%d"
set format x "%m-%d"
set key left autotitle columnhead
set style line 1 linecolor rgb '#0060ad' linetype 1 linewidth 1.5 pointtype 7 pointsize 0.6
set style line 2 linecolor rgb '#5cc863' linetype 2 linewidth 1.5 pointtype 7 pointsize 0.6
set xlabel 'Day'
set ylabel 'Kg'
plot 'fruitsales.csv' \
using 1:2 every ::1 with linespoints linestyle 1, \
'' using 1:3 every ::1 with linespoints linestyle 2
数据:
Period, Apples, Bananas
2022-12-02, 692, 561
2022-12-03, 162, 133
2022-12-04, 152, 121
2022-12-05, 181, 143
2022-12-06, 179, 147
2022-12-07, 177, 146
2022-12-08, 167, 139
2022-12-09, 179, 138
2022-12-10, 197, 126
2022-12-11, 142, 120
2022-12-12, 171, 142
2022-12-13, 184, 153
2022-12-14, 178, 145
2022-12-15, 171, 141
2022-12-16, 153, 125
2022-12-17, 177, 144
2022-12-18, 142, 121
2022-12-19, 179, 145
2022-12-20, 183, 155
2022-12-21, 174, 143
2022-12-22, 167, 138
2022-12-23, 166, 137
2022-12-24, 128, 105
2022-12-25, 139, 117
2022-12-26, 144, 119
2022-12-27, 158, 133
2022-12-28, 172, 144
2022-12-29, 178, 144
2022-12-30, 214, 176
2022-12-31, 167, 138
2023-01-01, 130, 109
2023-01-02, 159, 130
2023-01-03, 192, 163
2023-01-04, 175, 145
2023-01-05, 181, 149
2023-01-06, 189, 150
2023-01-07, 147, 121
2023-01-08, 138, 115
2023-01-09, 187, 139
2023-01-10, 232, 178
2023-01-11, 190, 132
2023-01-12, 203, 161
2023-01-13, 203, 170
2023-01-14, 190, 160
2023-01-15, 142, 122
2023-01-16, 185, 148
2023-01-17, 193, 156
2023-01-18, 187, 157
2023-01-19, 187, 160
2023-01-20, 170, 140
2023-01-21, 162, 133
2023-01-22, 166, 137
2023-01-23, 173, 140
2023-01-24, 173, 145
2023-01-25, 175, 146
2023-01-26, 171, 141
2023-01-27, 175, 148
2023-01-28, 161, 135
2023-01-29, 159, 135
2023-01-30, 183, 147
2023-01-31, 177, 146
2023-02-01, 215, 182
2023-02-02, 206, 174
2023-02-03, 194, 163
2023-02-04, 239, 210
2023-02-05, 247, 222
2023-02-06, 326, 297
2023-02-07, 304, 274
2023-02-08, 290, 265
2023-02-09, 347, 320
2023-02-10, 303, 266
2023-02-11, 349, 324
2023-02-12, 407, 383
2023-02-13, 337, 301
2023-02-14, 359, 333
2023-02-15, 356, 321
2023-02-16, 377, 339
2023-02-17, 337, 302
2023-02-18, 355, 326
2023-02-19, 329, 303
我不想xrange
在绘图命令中指定,因为数据文件每天都会变化。
如何避免线条左右两侧出现间隙?
答案1
添加
set autoscale xfix
修复了图表