bugGNU Octave - Bugs: bug #35662, Using default arguments for axis...

 
 

bug #35662: Using default arguments for axis properties causes error

Submitter:  Muhali <muhali>
Submitted:  Tue 28 Feb 2012 10:56:32 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 28 Dec 2014 01:54:08 AM UTC, comment #4: 

Somewhere in the past two years this has been fixed.  The example code now runs on the development branch of Octave.  This was with a tip from Dec. 23rd, 2014 (eee9f111c164).  Closing report.

Rik <rik5>
Group administrator
Fri 02 Mar 2012 07:30:34 PM UTC, comment #3: 

Actually, this is a general problem with all the update_XXX functions which don't just set a variable but call other update_XXX functions.  I'm going to re-title the bug to reflect that.

Here is another example


set (0, 'defaultaxesxlim', [-1 2])
gca
error: __go_axes__: operator *: nonconformant arguments (op1 is 0x0, op2 is 4x1)


The issue is that when the axis is being constructed it overrides the defaults by calling set_XXX with the new default.  This function call is done before any other axis setup has been done and so the set_XXX functions which rely on having an existing axis fail.

One obvious solution would be to build the axis, and then set all the defaults.  This would obviously have a lot of redundancy as an axis was set up with multiple properties which then needed to be changed.

A second idea would be to code some signaling variable, such as building_axes, which updating functions would check before calling the update function.

For example, Here is the code for the set_ticklength function


  void set_ticklength (const octave_value& val)
  {
    if (! error_state)
      {
        if (ticklength.set (val, true))
          {
            update_ticklength ();
            mark_modified ();
          }
      }
  }


And here it is with the proposed change


  void set_ticklength (const octave_value& val)
  {
    if (! error_state)
      {
        if (ticklength.set (val, true) && ! building_axes)
          {
            update_ticklength ();
            mark_modified ();
          }
      }
  }


It's still a hack, but right now Octave is broken for several properties that one can set defaults on.

Rik <rik5>
Group administrator
Wed 29 Feb 2012 07:18:22 PM UTC, comment #2: 

This was likely introduced by my changeset below.

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

Which as a fix for the bug below

https://savannah.gnu.org/bugs/?35438

Rik recently pushed a related changeset as well

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

Ben Abbott <bpabbott>
Group Member
Wed 29 Feb 2012 06:58:06 PM UTC, comment #1: 

Confirmed on a recent tip (2/29/12).

Rik <rik5>
Group administrator
Tue 28 Feb 2012 10:56:32 PM UTC, original submission:  

This code


tl = get(0, "defaultaxesticklength") ;
set(0, "defaultaxesticklength", tl/2) ;
plot(rand(2,1)) ;


results in the following error:

error: _go_axes_: operator *: nonconformant arguments (op1 is 0x0, op2 is 4x1)
error: called from:
error:   /tmp/octave-3.7/share/octave/3.7.0+/m/plot/axes.m at line 39, column 9
error:   /tmp/octave-3.7/share/octave/3.7.0+/m/plot/gca.m at line 45, column 9
error:   /tmp/octave-3.7/share/octave/3.7.0+/m/plot/__plt_get_axis_arg__.m at line 64, column 11
error:   /tmp/octave-3.7/share/octave/3.7.0+/m/plot/plot.m at line 186, column 25
error:   /tmp/foo.m at line 3, column 1

Muhali <muhali>

 

(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 (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by muhali (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
    2014-12-28 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2012-03-02 rik5 Summaryset ticklength breaks plot Using default arguments for axis properties causes error
    2012-02-29 rik5 CategoryNone Plotting with OpenGL
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code