bugGNU Octave - Bugs: bug #35430, fltk figure units =...

 
 

bug #35430: fltk figure units = "normalized" shrinks plot to 1 pixel

Submitter:  Ben Abbott <bpabbott>
Submitted:  Wed 01 Feb 2012 07:11:19 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Ben Abbott Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 12 Feb 2012 02:14:34 AM UTC, comment #7: 

I pushed a changeset

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

I'm closing the report.

Ben Abbott <bpabbott>
Group Member
Sat 11 Feb 2012 01:08:55 AM UTC, comment #6: 

I attached a changeset that works for me. It avoids triggering listeners (as suggested by Michael Goffioul).

Using the default branch, and with the tip below, it works for me.


$ hg tip
changeset:   14357:c097c22e9294
tag:         tip
user:        Ben Abbott  <bpabbott@mac.com>
date:        Fri Feb 10 18:57:55 2012 -0500
summary:     print.m: Restore figure properties in reverse of the order of modification.


(file #25044)

Ben Abbott <bpabbott>
Group Member
Sun 05 Feb 2012 01:49:48 AM UTC, comment #5: 

I've put together a 2nd changset. It doesn't do as Michael suggested (I was unable -- maybe due to my lack of c++ experience -- to do as he suggested).

(file #24983)

Ben Abbott <bpabbott>
Group Member
Sat 04 Feb 2012 11:31:29 PM UTC, comment #4: 

That changeset only works when drawnow() is called. A broader solution is needed.

Michael Goffioul made the suggestion below,

In _init_fltk_.cc, plot_window::draw() maps figure's position property to the FLTK window location (which is in pixels). This is only valid when the figure's units is in pixels [1]. The proper implementation is to use the figure::properties::get_boundingbox() method to obtain the figure location in pixels.

Ben Abbott <bpabbott>
Group Member
Sat 04 Feb 2012 09:33:44 PM UTC, comment #3: 

I've attached a patch.

(file #24982)

Ben Abbott <bpabbott>
Group Member
Thu 02 Feb 2012 07:26:43 PM UTC, comment #2: 

Another observation. Running the script below produces the correct output to the console


close all
graphics_toolkit fltk
figure
set (gcf, 'units', 'normalized')
get (gcf, 'position')


The output is


ans =

   0.17798   0.19358   0.33333   0.40856


If a drawnow() is inserted before the get() command, then the incorrect result is returned.


close all
graphics_toolkit fltk
figure
set (gcf, 'units', 'normalized')
drawnow ()
get (gcf, 'position')


The incorrect output is


ans =

    0   44    1    0


Ben Abbott <bpabbott>
Group Member
Thu 02 Feb 2012 01:44:40 AM UTC, comment #1: 

More info. First with gnuplot


graphics_toolkit gnuplot
figure
pixels = get (gcf, "position")
pixels =

   300   200   560   420

set (gcf, "units", "normalized")
normalized = get (gcf, "position")
normalized =

   0.17798   0.19358   0.33333   0.40856


Now with fltk


graphics_toolkit fltk
figure
pixels = get (gcf, "position")
pixels =

   1014     44    560    420

set (gcf, "units", "normalized")
normalized = get (gcf, "position")
normalized =

    0   44    1    0


 Gnuplot and fltk behave differently.

I hadn't realized that this part of the code was backend specific.

Ben Abbott <bpabbott>
Group Member
Wed 01 Feb 2012 07:11:19 PM UTC, original submission:  

These commands display an empty figure as expected.


graphics_toolkit fltk
figure (1)


Changing the units to normalized results in a small figure in the UL of the screen (1 pixel wide ?)


set (1, "units", "normalized")



Ben Abbott <bpabbott>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #25044:  changeset-7.patch added by bpabbott (3KiB - application/octet-stream)
file #24983:  changeset-__init_fltk__.patch added by bpabbott (837B - application/octet-stream - 2nd changeset)
file #24982:  changeset.patch added by bpabbott (837B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bpabbott (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-08-07 bpabbott StatusReady For Test Fixed
    2012-02-12 bpabbott Open/ClosedOpen Closed
    2012-02-11 bpabbott StatusPatch Submitted Ready For Test
    2012-02-11 bpabbott Attached File- Added changeset-7.patch, #25044
    2012-02-05 bpabbott Attached File- Added changeset-__init_fltk__.patch, #24983
    2012-02-04 bpabbott Attached File- Added changeset.patch, #24982
        StatusNone Patch Submitted

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code