bugGNU Octave - Bugs: bug #35034, Plotting: axis returns wrong...

 
 

bug #35034: Plotting: axis returns wrong value, axis ('tight') not working properly

Submitted by:  Lukas Reichlin <paramaniac>
Submitted on:  Sun 11 Dec 2011 07:39:42 PM UTC  
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  Ben Abbott <bpabbott>
Originator Name:  Open/Closed:  Closed
Release:  3.4.3 Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Thu 15 Dec 2011 07:29:18 AM UTC, comment #9: 

The latest patch worked and looked good so I pushed it under your name here (http://hg.savannah.gnu.org/hgweb/octave/rev/ec79cd8359c5).

Rik <rik5>
Project Administrator
Thu 15 Dec 2011 01:36:24 AM UTC, comment #8: 

Third attempt

(file #24600)

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Wed 14 Dec 2011 02:43:19 AM UTC, comment #7: 

The patch works for me.  I have one question about the complexity of the cellfun expressions.

data = data (find (! cellfun ("isempty", data)));
if (! isempty (data))
  lims_min = min (cellfun ("min", cellfun ("min", data, 'uniformoutput', false)(:)));
  lims_max = max (cellfun ("max", cellfun ("max", data, 'uniformoutput', false)(:)));
  lims = [lims_min, lims_max];

In the first line, you can safely remove the call to find();  logical indexing of cell arrays is just fine.

For the second bit, I think you are trying to find the minimum value across all the datasets regardless of datset orientation.  Would the code below be easier in that case?

lims_min = min (cellfun (@(x) min (x(:)), a(:)));

Rik <rik5>
Project Administrator
Tue 13 Dec 2011 07:56:56 PM UTC, comment #6: 

Yes I do. I'd like to vectorize some of it first. I hope to get to it Thursday or Friday.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Tue 13 Dec 2011 06:57:08 PM UTC, comment #5: 

Ben,

Do you want to apply the patch in this bug report before 3.6.0?

Rik <rik5>
Project Administrator
Sun 11 Dec 2011 09:24:09 PM UTC, comment #4: 

Test case for "ylim":

plot (11:20, [21:25, -Inf, 27:30])
a = ylim
axis ('tight')
b = ylim

Matlab R2011b

>> plot (11:20, [21:25, -Inf, 27:30])
a = ylim
axis ('tight')
b = ylim

a =

    21    30


b =

    21    30

>>

Octave 3.4.3

octave:1> plot (11:20, [21:25, -Inf, 27:30])
octave:2> a = ylim
a =

   20   30

octave:3> axis ('tight')
octave:4> b = ylim
b =

  -Inf    30

octave:5>

The screenshots look exactly like the ones I posted before

Lukas Reichlin <paramaniac>
Sun 11 Dec 2011 09:11:40 PM UTC, comment #3: 

Ok. Please do.  If you have the time, please provide me some demos and I'll add them to the changeset.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Sun 11 Dec 2011 08:55:58 PM UTC, comment #2: 

Great!

I realized that xlim, ylim and probably others are affected too:

plot (11:20, [21:25, -Inf, 27:30])
a = ylim
axis ('tight')
b = ylim

I couldn't check if your patch already fixes them as well.

Lukas Reichlin <paramaniac>
Sun 11 Dec 2011 08:41:15 PM UTC, comment #1: 

I've attached a changeset that fixes the problem for me.

(file #24568)

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Sun 11 Dec 2011 07:39:42 PM UTC, original submission:  

Octave shows unexpected behaviour when running the following code:

plot (11:20, [21:25, -Inf, 27:30])
a = axis
axis ('tight')
b = axis

Matlab returns b(3) = 21 whereas Octave returns b(3) = -Inf. Moreover, axis('tight') screws the plot up in Octave, see the attachments. The problem seems to be caused by the Inf value on the y-axis.

Matlab R2011b

>> plot (11:20, [21:25, -Inf, 27:30])
a = axis
axis ('tight')
b = axis

a =

    11    20    21    30


b =

    11    20    21    30

>>

Octave 3.4.3

octave:1> plot (11:20, [21:25, -Inf, 27:30])
octave:2> a = axis
a =

   10   20   20   30

octave:3> axis ('tight')
octave:4> b = axis
b =

    11    20  -Inf    30

octave:5>

Lukas Reichlin <paramaniac>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #24600:  changeset.patch added by bpabbott (3KiB - application/octet-stream - third attempt)
file #24587:  changeset.patch added by bpabbott (2KiB - application/octet-stream - changeset with vectorized code)
file #24568:  changeset.patch added by bpabbott (2KiB - application/octet-stream)
file #24566:  matlab.png added by paramaniac (35KiB - image/png)
file #24567:  octave.png added by paramaniac (23KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by bpabbott (Updated the item)
  • -email is unavailable- added by paramaniac (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-12-15 rik5 StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2011-12-15 bpabbott Attached File- => Added changeset.patch, #24600
        Assigned toNone => bpabbott
    2011-12-13 bpabbott Attached File- => Added changeset.patch, #24587
    2011-12-11 bpabbott Attached File- => Added changeset.patch, #24568
        StatusNone => Ready For Test
        Operating SystemMac OS => Any
    2011-12-11 paramaniac Attached File- => Added matlab.png, #24566
        Attached File- => Added octave.png, #24567

    Back to the top


    Powered by Savane 3.5