bugGNU Octave - Bugs: bug #34158, axis with x_min>x_max

 
 

bug #34158: axis with x_min>x_max

Submitter:  Matthias Jüschke <maju>
Submitted:  Sun 28 Aug 2011 06:21:10 PM UTC
   
 
Category:  Plotting with gnuplot Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  bpabbott
Originator Name:  Open/Closed:  * Closed
Release:  * 3.4.2 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 02 Sep 2011 05:40:38 PM UTC, comment #4: 

Good suggestion. I've pushed a slight modification of the suggested change.

http://hg.savannah.gnu.org/hgweb/octave/rev/f7af3834405c

Ben Abbott <bpabbott>
Group Member
Fri 02 Sep 2011 05:11:16 PM UTC, comment #3: 

For x- y- zlim.m there is a similar effect. As I found in
/usr/share/octave/3.4.0/m/plot/private/__axes_limits__.m
the last case of the if-block

      else
        set (h, fcn, arg(:));
      endif

should be replaced by something like

      else
        if arg(1)>=arg(2)
          error('Axis limits must be increasing.')
        else
          set (h, fcn, arg(:));
        endif
      endif

In matlab, you can set a value to Inf, if it is the second, the axis is set to arg(1)+1.

Matthias Jüschke <maju>
Fri 02 Sep 2011 01:31:10 AM UTC, comment #2: 

I'm closing this item

Ben Abbott <bpabbott>
Group Member
Wed 31 Aug 2011 10:27:27 PM UTC, comment #1: 

I slightly modified the suggested modification and pushed a changeset.

http://hg.savannah.gnu.org/hgweb/octave/rev/d2997525fcb6

Ben Abbott <bpabbott>
Group Member
Sun 28 Aug 2011 06:21:10 PM UTC, original submission:  

Using axis with x_min>x_max the x-axis is set to [0,1].
Example:

plot(1:2)
axis([2 1 1 2])


This could be solved asking in axis.m in

function curr_axis = __axis__ (ca, ax, varargin)
...
% ask instead of
if (ax(i) == ax(i+1))
  error ("axis: limits(%d) cannot equal limits(%d)", i, i+1);
endif
% for
if (ax(i) <= ax(i+1))
  error ("axis: limits(%d) has to be less than limits(%d)", i, i+1);
endif

Alternativly, the values could be swapped (and the axis direction can be changed).

The same problem occurs using xlim.

Matthias Jüschke <maju>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bpabbott (Updated the item)
  • -email is unavailable- added by maju (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-09-02 bpabbott StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2011-08-31 bpabbott StatusIn Progress Ready For Test
    2011-08-31 bpabbott StatusNone In Progress
        Assigned toNone bpabbott

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code