bugGNU Octave - Bugs: bug #35393, Switching figure toolkit with...

 
 

bug #35393: Switching figure toolkit with graphics_toolkit() closes figure

Submitter:  Rik <rik5>
Submitted:  Sat 28 Jan 2012 09:27:37 PM UTC
   
 
Category:  Plotting with gnuplot Severity:  2 - Minor
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  bpabbott
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 26 Feb 2012 11:27:18 PM UTC, comment #5: 
Ben Abbott <bpabbott>
Group Member
Sun 26 Feb 2012 02:21:04 AM UTC, comment #4: 

The following produces the proper result.


close all
graphics_toolkit fltk;
h1 = figure (1);
graphics_toolkit (h1, "gnuplot");  # Figure disappears
drawnow ()
set (gcf, "__modified__", "on")

graphics_toolkit gnuplot
h2 = figure (2);
graphics_toolkit (h2, "fltk");


Which I infer to indicate the updater needs to do,


update___graphics_toolkit__ (void)
{
  feval ("drawnow");
  set___modified__ ("on");
}


I'm still struggling to figure out how this should be done.

Ben Abbott <bpabbott>
Group Member
Sun 26 Feb 2012 01:46:20 AM UTC, comment #3: 

Looking more, I think what is needed is something like below.


figure::properties::update___graphics_toolkit__ (void)
{
  feval ("drawnow", figure_handle)
}


At the moment, I'm having trouble figuring out what the genprops.awk script needs to see in graphics.h.in


3419       string_property xvisual , ""
3420       radio_property xvisualmode , "{auto}|manual"
3421       callback_property buttondownfcn , Matrix ()
3422       string_property __graphics_toolkit__ ?? , "gnuplot"
3423       any_property __guidata__ h , Matrix ()
3424     END_PROPERTIES


I've tried both "su" and "sU" in place of "??" but either did something wrong or those qualifiers aren't correct.

Suggestions are welcome :-)

Ben Abbott <bpabbott>
Group Member
Sun 26 Feb 2012 12:49:50 AM UTC, comment #2: 

I tried the script below.


close all
graphics_toolkit fltk;
h1 = figure (1);
peaks
graphics_toolkit (h1, "gnuplot");  # Figure disappears

graphics_toolkit gnuplot
h2 = figure (2);
peaks
graphics_toolkit (h2, "fltk");


The result is correct. Figure 1 contains the proper plot in a gnuplot window and figure 2 contains the proper plot in an FLTK window.

I don't understand how FLTK knows the window needs to be shut when it is swtiched to gnuplot, but it looks like the fix for the reported problem needs a very simple updater


figure::properties::update___graphics_toolkit__ (void)
{
  set___modified__ ("on");
}


I'll make an attempt to fix this.

Ben Abbott <bpabbott>
Group Member
Sun 26 Feb 2012 12:23:23 AM UTC, comment #1: 

Looking at graphics.h.in, I see there is no updater for the figure's _graphics_toolkit_ property. So there is less than "an overly simple listener" ;-)


3419       string_property xvisual , ""
3420       radio_property xvisualmode , "{auto}|manual"
3421       callback_property buttondownfcn , Matrix ()
3422       string_property __graphics_toolkit__ s , "gnuplot"
3423       any_property __guidata__ h , Matrix ()
3424     END_PROPERTIES


We can gell genprops.awk there is a custom updater by adding the "u" qualifier.


3419       string_property xvisual , ""
3420       radio_property xvisualmode , "{auto}|manual"
3421       callback_property buttondownfcn , Matrix ()
3422       string_property __graphics_toolkit__ s u , "gnuplot"
3423       any_property __guidata__ h , Matrix ()
3424     END_PROPERTIES


Then we'll need to add the updater.


figure::properties::update___graphics_toolkit__ (void)
{
...
}


What should the updater do ?


Ben Abbott <bpabbott>
Group Member
Sat 28 Jan 2012 09:27:37 PM UTC, original submission:  

This is a small and odd bug.  If a graphics figure is created with the gnuplot backend, but no plot is made, and then that figure is switched to the FLTK backend then the figure is destroyed rather than converted.  The reverse, starting with a blank FLTK figure and switching to gnuplot works.

The figure needs to be blank which suggests that the listener on "__graphics_toolkit__" is using an overly simple test to determine whether a figure exists.

Code to reproduce the problem:


close all
graphics_toolkit fltk;
h1 = figure;
graphics_toolkit (h1, "gnuplot");  # Figure disappears

BUT, this works
close all
graphics_toolkit gnuplot
h1 = figure;
graphics_toolkit (h1, "fltk");


Rik <rik5>
Group administrator

 

(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 (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
    2012-02-26 bpabbott StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2012-02-26 bpabbott StatusNone In Progress
        Assigned toNone bpabbott
        Release3.6.0 dev

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code