|
From: Ethan M. <eam...@gm...> - 2016-07-01 17:10:17
|
On Friday, July 01, 2016 10:21:29 AM Grothausmann, Roman Dr. wrote:
> Dear mailing list members,
>
>
> When plotting data with kernel-densities with filled-curves I can't find a
> way to make the filling reach down to y=0 (using gnuplot-5.0.3). This is
> especially visible if the x-range "crops" the kdensity plot before it gets
> close to y=0. However plotting x**2-2 has no problems to "pull down" the
> filling to any y=a. For example the script below does not fill the plot.
> When removing "=0" it gets filled but for a kdensity plot looks odd as the
> filling does not go down to y=0. Even with any other y=a for a>0 there is
> no filling, e.g. y=0.01:
>
> if (GPVAL_VERSION < 5.0) {print "This script needs gnuplot-5.x\n"; exit;}
>
> bin=17
> sigma=3
> col=1
>
> set samples 1000
> set boxwidth bin
> bin (x,s)= s* int(x/s)
>
> STATS_records=7
> plot [0:180][-0.01:0.1] "-" u col:(1. / STATS_records) smooth kdensity
> bandwidth sigma with filledcurves y=0
> 10
> 11
> 30
> 35
> 180
> 180
> 180
> e
>
>
> Any help or hints are very much appreciated
> Roman
I do not know why the filledcurves style is failing in conjunction with
smoothing, but a work-around is to plot first to a datablock and then plot
the smoothed curve in a separate step:
set table $SMOOTHED
plot $original_data using col:(weight) smooth kdensity bandwidth sigma
unset table
plot $SMOOTHED using 1:2 with filledcurves y=0
Ethan
|