Gnuplot绘制时间序列折线图左右边缘存在间隙的解决方案咨询
Gnuplot绘制时间序列折线图左右边缘存在间隙的解决方案咨询
我在使用Gnuplot 5.2和5.4.5版本绘制时间序列数据时,发现折线无法贴合绘图区域的左右边缘。如果删除CSV文件末尾的几行数据,情况会有所改善;删除更多行后,折线就能完全贴合左右边缘,这正是我想要的效果。
Gnuplot绘图脚本
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
数据文件(fruitsales.csv)
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,因为数据文件每天都会更新。请问有没有办法让折线自动贴合绘图区域的左右边缘,消除这些间隙?
备注:内容来源于stack exchange,提问作者RedGrittyBrick
相关产品推荐
相关产品推荐

