octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tests in log-scale plots


From: Ben Abbott
Subject: Re: tests in log-scale plots
Date: Sun, 11 Sep 2011 21:48:13 -0400

On Sep 10, 2011, at 9:17 PM, Ben Abbott wrote:

> On Sep 7, 2011, at 8:20 AM, bpabbott wrote:
> 
>> On Sep 07, 2011, at 07:48 AM, "c." <address@hidden> wrote:
>> 
>>> 
>>> On 7 Sep 2011, at 13:44, bpabbott wrote:
>>> 
>>>> Carlo, what is the value for the 'ydir' property after the "loglog(a,b)" 
>>>> plot?
>>>> 
>>>> Is is actually reversed in 2007b? Since -10 < -1, I expect the setting of 
>>>> ydir is still normal
>>>> 
>>>> Ben
>>> 
>>> Ben,
>>> 
>>> Now I see what you mean:
>>> 
>>>>> loglog (a, b) 
>>>>> get (gca, 'ydir')
>>> 
>>> ans =
>>> normal
>>> 
>>>>> 
>>> 
>>> On the other hand, to reproduce the same plot using abs (b) I have to do
>>> 
>>>>> loglog (a, abs(b))
>>>>> set (gca, 'ydir', 'reverse')
>>>>> get (gca, 'ydir')
>>> 
>>> ans =
>>> reverse
>>> 
>>> c.
>> 
>> I think the proper way to handle negative numbers, in log plots, is to have 
>> the backend do the job.
>> 
>> For gnuplot this needs to be done in __go_draw_axes__.m
>> 
>> Ben
> 
> I've had a long discussion with Michael Godfrey on this problem, which led to 
> the attached patch for graphics.cc and graphics.h.in.
> 
> The attached patch is intended to implement the fix the front-end. Changes 
> are still required for __go_draw_axes__.m and gl-renderer.cc.
> 
> With this patch applied to the default branch ...
> 
>>>> x = logspace (-5, 5, 11);
>>>> loglog (-x, -x);
>>          line 0: x range must be greater than 0 for log scale
>> 
>>>> get (gca, "xtick")
>> ans =
>> 
>> -1.0000e+06  -1.0000e+04  -1.0000e+02  -1.0000e+00  -1.0000e-02  -1.0000e-04 
>>  -1.0000e-06
>> 
>>>> get (gca, "ytick")
>> ans =
>> 
>> -1.0000e+06  -1.0000e+04  -1.0000e+02  -1.0000e+00  -1.0000e-02  -1.0000e-04 
>>  -1.0000e-06
> 
> My c/c++ skills deserve skepticism. I'd appreciate it if someone would look 
> over the patch.
> 
> Ben
> 
> <log_and_negative_values.diff>

The attached changeset enables the loglog.m tests to pass.

If there are no suggestions for changes to the code, I'll push this to default 
in the next day or two.

Ben

Attachment: changeset.patch
Description: Binary data




reply via email to

[Prev in Thread] Current Thread [Next in Thread]