Gnuplot:绘制累积分布中的逐步不连续点

Gnuplot: Plot stepwise discontinuities in a cumulative distriubtion

当我使用 gnuplot 绘制累积分布时,它会在数据点之间进行插值;这可以在紫色曲线中看到。如何将我的数据绘制为像黑色曲线一样的逐步函数?类似于 step method in matplotlib.

源数据

1,1,0
1,2,0
1,3,0
1,4,2
1,5,1
1,6,3
1,7,3
1,8,1
1,9,3
1,10,8
1,11,1
1,12,0
1,13,3

Gnuplot 源代码

set terminal pngcairo font ",14"
set output "cumulative.png"
#set terminal qt font ",14"
set title "Cumulative count" font ",16"
set xlabel "episode"
set ylabel "cumulative count"
set xtics 1
set key bottom right
set grid
unset border

set datafile separator comma
plot "season-01-count.csv" u 2:() smooth cumulative title "cumulative count"

您是否进行过搜索或查看过手册?检查 help steps 或在此处检查:http://gnuplot.sourceforge.net/demo_5.2/steps.html or the graph here:

代码:

### plot with steps
reset session

$Data <<EOD
1,1,0
1,2,0
1,3,0
1,4,2
1,5,1
1,6,3
1,7,3
1,8,1
1,9,3
1,10,8
1,11,1
1,12,0
1,13,3
EOD

set title "Cumulative count" font ",16"
set xlabel "episode"
set ylabel "cumulative count"
set xtics 1
set key bottom right
set grid
unset border

set datafile separator comma
plot $Data u 2:() smooth cumulative with steps lw 2 lc "red" ti "cumulative count"
### end of code

结果: