(I posted this to gnuplot-bugs, but I see a lot of spam there, so I am
I have discovered a problem, perhaps a bug, with the following:
set xrange [0:10]
set logscale y
plot 'j' using (floor($1)):($2) smooth frequency with points
where the 'j' file is:
The result I get is very wrong: e.g., at x=2, I get y=1e-6. And at x=9,
I get 2e-6.
When logscale y is disabled, the results look correct. Am I doing
something wrong? Or is this a bug?
*I do not subscribe to the list, so please CC me in your reply.*
Kostas Oikonomou wrote:
> set xrange [0:10]
> set logscale y
> plot 'j' using (floor($1)):($2) smooth frequency with points
First of all, a note: it's not very likely to be good idea to use
'smooth frequency' with a y column that is not a constant.
"Smooth frequency" adds all applicable y values for a given x position
and output that as the resulting data point. The idea is that you can
use a constant (1) as the y value, and thus obtain a count of numbers in
a given x interval.
The problem in your example is that the filter gets fed with
logarithmized y values if you 'set log y', i.e. it effectively
*multiplies* the values, rather than adding them. So at x=2, instead
of 0.01+0.01+0.01=0.03, you get 0.01*0.01*0.01=1e-6.
Whether that's a bug or not lies in the eye of the beholder. It's a
strange, undocumented feature, but it may actually be useful to some
people, in some situations ;-) As a workaround, you can always do the
number crunching outside gnuplot, or at least run the filter separately
from the plot itself (--> 'help table'), which allows you to filter in
linear y scale, but plot in log.