Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Log scale and image data

2,832 views
Skip to first unread message

Joey Mukherjee

unread,
Mar 16, 2010, 11:07:55 AM3/16/10
to
Hello!

I have a data set which I am trying to plot with the latest CVS
version of GNUplot that will not plot with log scaling. The error
message I get with autoscaling is ""/tmp/data.gnu", line 49174: y
range must be greater than 0 for log scale" and it is! If I hard code
the range to something like : set yrange [10:200], I don't get the
error message, but I don't get a plot either.

I am using a very simple plot line: plot "-" using 1:3:5 axes x1y1
with image and the data follows it. If I go to linear scale, I get my
plot as well.

Is this a bug? I'm happy to send a data file if it would help, but it
is too large to post.

Thanks,
Joey

sfeam

unread,
Mar 16, 2010, 12:37:34 PM3/16/10
to
Joey Mukherjee wrote:

> Hello!
>
> I have a data set which I am trying to plot with the latest CVS
> version of GNUplot that will not plot with log scaling. The error
> message I get with autoscaling is ""/tmp/data.gnu", line 49174: y
> range must be greater than 0 for log scale" and it is! If I hard code
> the range to something like : set yrange [10:200], I don't get the
> error message, but I don't get a plot either.
>
> I am using a very simple plot line: plot "-" using 1:3:5 axes x1y1
> with image and the data follows it. If I go to linear scale, I get my
> plot as well.

But does the y range indeed include zero?
If so, the error message is simply stating the mathematical truth
that a log-scale range cannot span zero.


> Is this a bug? I'm happy to send a data file if it would help, but it
> is too large to post.

That is not necessary.
Make your linear plot and then type
show yrange


Joey Mukherjee

unread,
Mar 16, 2010, 1:14:31 PM3/16/10
to
On Mar 16, 11:37 am, sfeam <sf...@users.sourceforge.net> wrote:
> Joey Mukherjee wrote:

> > I have a data set which I am trying to plot with the latest CVS
> > version of GNUplot that will not plot with log scaling.  The error
> > message I get with autoscaling is ""/tmp/data.gnu", line 49174: y
> > range must be greater than 0 for log scale" and it is!  If I hard code
> > the range to something like : set yrange [10:200], I don't get the
> > error message, but I don't get a plot either.
>
> > I am using a very simple plot line: plot "-" using 1:3:5 axes x1y1
> > with image and the data follows it.  If I go to linear scale, I get my
> > plot as well.
>
> But does the y range indeed include zero?
> If so, the error message is simply stating the mathematical truth
> that a log-scale range cannot span zero.

No, the y-data does not contain zero or negative numbers.


>
> > Is this a bug?  I'm happy to send a data file if it would help, but it
> > is too large to post.
>
> That is not necessary.
> Make your linear plot and then type
>   show yrange

gnuplot> show yrange

set yrange [ * : * ] noreverse nowriteback # (currently
[9.34098:9.87254] )

is what I get, but those number are very strange. My plot goes from 0
to 250 on the y axis? Where do these numbers come from?

Joey

sfeam

unread,
Mar 16, 2010, 4:12:50 PM3/16/10
to
Joey Mukherjee wrote:

> On Mar 16, 11:37 am, sfeam <sf...@users.sourceforge.net> wrote:
>> Joey Mukherjee wrote:
>
>> > I have a data set which I am trying to plot with the latest CVS
>> > version of GNUplot that will not plot with log scaling.  The error
>> > message I get with autoscaling is ""/tmp/data.gnu", line 49174: y
>> > range must be greater than 0 for log scale" and it is!  If I hard code
>> > the range to something like : set yrange [10:200], I don't get the
>> > error message, but I don't get a plot either.
>>
>> > I am using a very simple plot line: plot "-" using 1:3:5 axes x1y1
>> > with image and the data follows it.  If I go to linear scale, I get my
>> > plot as well.
>>
>> But does the y range indeed include zero?
>> If so, the error message is simply stating the mathematical truth
>> that a log-scale range cannot span zero.
>
> No, the y-data does not contain zero or negative numbers.

You say that, but...

>[snip]


> My plot goes from 0
> to 250 on the y axis? Where do these numbers come from?

Here you say it goes from 0, which means you cannot use a log scale.
Try setting:
set yrange [0.1:*]

Hans-Bernhard Bröker

unread,
Mar 16, 2010, 4:14:38 PM3/16/10
to
Joey Mukherjee wrote:

> No, the y-data does not contain zero or negative numbers.

[...]


> My plot goes from 0 to 250 on the y axis?

Hmm... haven't you just contradicted yourself?

Joey Mukherjee

unread,
Mar 16, 2010, 4:48:24 PM3/16/10
to
On Mar 16, 3:14 pm, Hans-Bernhard Bröker <HBBroe...@t-online.de>
wrote:

The axis goes from 0 to 250, but my lowest value in my data is
0.0782884, not zero.

If I do a "set yrange [0.1:*]", I do see my plot, but the there is a
huge blank space between 0.1 and 10, and the rest of the data from 10
to 200 or so and then more blank space from 250 to 1000. If I set the
lower value to 10 in the set yrange command, I see no plot at all! I
just want to see the data from 10 to 200 along a logarithmic Y scale.

I'm happy to email a script to someone if it would help!

Joey

sfeam

unread,
Mar 17, 2010, 1:07:18 AM3/17/10
to
Joey Mukherjee wrote:

> I just want to see the data from 10 to 200 along a logarithmic Y scale.

So did you try
set yrange [10:200]
?

Joey Mukherjee

unread,
Mar 17, 2010, 3:51:58 PM3/17/10
to

Yes, and that is when I do not see a plot. That's the bug! I don't
think the y-range is working correctly on a log scale with an image.

Joey

sfeam

unread,
Mar 17, 2010, 6:39:05 PM3/17/10
to
Joey Mukherjee wrote:

OK. I can reproduce this.
Yes, it's a bug.
I don't know of a work-around.

Ingo Thies

unread,
Mar 18, 2010, 1:16:17 PM3/18/10
to
Am 2010-03-17 23:39, schrieb sfeam:

> OK. I can reproduce this.
> Yes, it's a bug.
> I don't know of a work-around.

After reading this thread, I have made a similar test. I have image data
from about 0:6 in x and 0:25 in y. Setting xrange to 0.1:10 and logscale
x my plot dissappears as well, and I am getting the warning "Image grid
must be at least 2 x 2." (using a recent CVS version).

Another effect that may be related to this problem: Try setting the
xrange to the same value as in the logscale plot, but instead of using
the logscale just replace 1:... by (log10($1)):... in the "using"
statement. Instead of rescaling the abscissae to the log values the plot
gets completely distorted in *both* axes. This, however, was not
reproducable: In subsequent tests there was no plot at all but the
message "Number of pixels cannot be factored into integers matching
grid. N = 180901 K = 101". Other nonlinear modifiers like sqrt(x), x**2
seem to work normally.

Maybe these infos could help to solve the problem.


Ingo

0 new messages