octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changes to graphics.cc and subplot.m


From: Ben Abbott
Subject: Re: changes to graphics.cc and subplot.m
Date: Mon, 22 Jul 2013 02:46:34 +0200

On Jul 21, 2013, at 11:10 PM, Stefan Mahr wrote:

>>> oops!  The test only fails for me the 1st time it is run, and only because 
>>> the axes handles are in the wrong order.
>>> 
>>> Ben
>> 
>> It's weird. With your test script I get the same results as you.
>> However, the resulting output still has different y-axis size for both
>> plots.
>> 
>> If I copy-paste your example block-wise in interactive mode, I get more
>> errors. Could it be some kind of timing problem?
>> 
>> -----------
>> 
>>  graphics_toolkit fltk
>>  close all
>>  hf = figure (gcf (), "__graphics_toolkit__", "fltk", "visible", "on");
>> 
>> 
>>  subplot(2,1,1); plot(rand(10,1)); subplot(2,1,2); plot(rand(10,1))
>>  hax = findall (gcf (), "type", "axes");
>>  positions = cell2mat (get (hax, "position"));
>>  outerpositions = cell2mat (get (hax, "outerposition"));
>>  looseinsets = cell2mat (get (hax, "looseinset"));
>>  tightinsets = cell2mat (get (hax, "tightinset"));
>>  close all
>> 
>> 
>>  subplot(2,1,1); plot(rand(10,1)); subplot(2,1,2); plot(rand(10,1))
>>  hax = findall (gcf (), "type", "axes");
>>  assert (cell2mat (get (hax, "position")), positions, 0.001)
>>  assert (cell2mat (get (hax, "outerposition")), outerpositions, 0.001)
>>  assert (cell2mat (get (hax, "looseinset")), looseinsets, 0.001)
>>  assert (cell2mat (get (hax, "tightinset")), tightinsets, 0.001)
>> 
>> ------------------------
>> 
>>> assert (cell2mat (get (hax, "position")), positions, 0.001)
>> error: assert (cell2mat (get (hax, "position")),positions,0.001) expected
>>   0.13000   0.58384   0.77500   0.32733
>>   0.13000   0.12384   0.77500   0.32733
>> but got
>>   0.13000   0.60122   0.77500   0.30994
>>   0.13000   0.18964   0.77500   0.26152
>> maximum absolute error 0.0658047 exceeds tolerance 0.001
>> error: called from:
>> error:   /usr/share/octave/3.7.5/m/testfun/assert.m at line 235, column 5
>>> assert (cell2mat (get (hax, "outerposition")), outerpositions, 0.001)
>>> assert (cell2mat (get (hax, "looseinset")), looseinsets, 0.001)
>>> assert (cell2mat (get (hax, "tightinset")), tightinsets, 0.001)
>> error: assert (cell2mat (get (hax, "tightinset")),tightinsets,0.001)
>> expected
>>   0.042857   0.013122   0.000000   0.026316
>>   0.042857   0.013199   0.000000   0.026316
>> but got
>>   0.04286   0.09122   0.00000   0.01696
>>   0.04286   0.13964   0.00000   0.00000
>> maximum absolute error 0.126443 exceeds tolerance 0.001
>> error: called from:
>> error:   /usr/share/octave/3.7.5/m/testfun/assert.m at line 235, column 5
> 
> It's even more weird. I created a ismac.m that returns always 1. Now the
> first plot looks fine, even without figure command. After 'close all'
> the behaviour is as described before.

Ok.  Thats not so weird, but does bring up a some weird history.  The figure() 
command includes the part below.

      if (ismac () && strcmp (graphics_toolkit (), "fltk"))
        ## FIXME - Hack for fltk-aqua to work around bug #31931
        f = __go_figure__ (f);
        drawnow ();
        if (! isempty (varargin))
          set (f, varargin{:});
        endif
      else
        f = __go_figure__ (f, varargin{:});
      endif

So on Mac OSX, we always get an implicit "figure()" command.

This code was added as an clumsy hack to avoiding a crash.  If I remove it, the 
code below ...

        close all
        figure (1, 'visible', 'off'); peaks
        set (1, 'visible', 'on')

... still crashes octave.

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000578
0x00007fff8901c7f8 in glMatrixMode ()
(gdb) bt
#0  0x00007fff8901c7f8 in glMatrixMode ()
#1  0x000000010e50be06 in OpenGL_fltk::setup_viewport ()
#2  0x000000010e50bd8e in OpenGL_fltk::resize ()
#3  0x000000010e5eeff9 in Fl_Group::resize ()
#4  0x000000010e5d09a9 in Fl_Window::resize ()
#5  0x000000010e510ab3 in plot_window::resize ()
#6  0x000000010e5cc4f2 in -[FLWindowDelegate windowDidResize:] ()
#7  0x00007fff8fda8d0e in __-[NSNotificationCenter 
addObserver:selector:name:object:]_block_invoke_1 ()
#8  0x00007fff855087ba in _CFXNotificationPost ()
#9  0x00007fff8fd94fc3 in -[NSNotificationCenter 
postNotificationName:object:userInfo:] ()
#10 0x00007fff8cc0598c in -[NSWindow _setFrameCommon:display:stashSize:] ()
#11 0x00007fff8cc05093 in -[NSWindow setFrame:display:] ()
#12 0x000000010e5d095c in Fl_Window::resize ()
#13 0x000000010e510ccc in plot_window::draw ()
#14 0x000000010e5ce216 in -[FLView drawRect:] ()
#15 0x00007fff8cb552ce in -[NSView _drawRect:clip:] ()
#16 0x00007fff8cb8249b in -[NSView 
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#17 0x00007fff8cb828c7 in -[NSView 
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#18 0x00007fff8cb528a9 in -[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 ()
#19 0x00007fff8cb51da3 in -[NSThemeFrame 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 ()
#20 0x00007fff8cb4d1bb in -[NSView 
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] ()
#21 0x00007fff8cb45c35 in -[NSView displayIfNeeded] ()
#22 0x00007fff8cc032fb in -[NSWindow 
_reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] ()
#23 0x00007fff8cc02cf8 in -[NSWindow 
_doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] ()
#24 0x00007fff8cc0297c in -[NSWindow orderWindow:relativeTo:] ()
#25 0x00007fff8cc0221d in -[NSWindow makeKeyAndOrderFront:] ()
#26 0x000000010e5d0306 in Fl_X::make ()
#27 0x000000010e513865 in figure_manager::do_toggle_window_visibility ()
#28 0x000000010e513086 in figure_manager::toggle_window_visibility ()
#29 0x000000010e5130c6 in figure_manager::toggle_window_visibility ()
#30 0x000000010e514b16 in fltk_graphics_toolkit::update ()
#31 0x0000000100b6412b in graphics_toolkit::update ()
#32 0x0000000100b67194 in base_graphics_object::update ()
#33 0x0000000100b67a33 in graphics_object::update ()
#34 0x0000000100a340a8 in base_property::set ()
#35 0x0000000100b660a4 in base_properties::set_visible ()
#36 0x0000000100a44bbc in base_properties::set ()
#37 0x0000000100a5e3df in figure::properties::set ()
#38 0x0000000100b6baac in figure::set ()
#39 0x0000000100a3da90 in graphics_object::set_value_or_default ()
#40 0x0000000100a3d3cb in graphics_object::set ()
#41 0x0000000100b51a37 in Fset ()
#42 0x0000000100758472 in octave_builtin::do_multi_index_op ()
#43 0x0000000100758112 in octave_builtin::subsref ()
#44 0x0000000100758000 in octave_builtin::subsref ()
#45 0x0000000100826c36 in octave_value::subsref ()
#46 0x0000000100826cd5 in octave_value::subsref ()
#47 0x00000001008b523a in tree_index_expression::rvalue ()
#48 0x00000001008b4981 in tree_index_expression::rvalue ()
#49 0x00000001008b54d0 in tree_index_expression::rvalue1 ()
#50 0x00000001008adc16 in tree_evaluator::visit_statement ()
#51 0x00000001008d2884 in tree_statement::accept ()
#52 0x00000001008ade90 in tree_evaluator::visit_statement_list ()
#53 0x00000001008d2ecc in tree_statement_list::accept ()
#54 0x0000000100d3eec9 in main_loop ()
#55 0x00000001003dbd2f in octave_execute_interpreter ()
#56 0x000000010000aa6f in main ()

Perhaps the timing problem that results in the wrong axes positions on Linux, 
crashes Octave on Mac OSX before the plot is rendered.

However, with the hack still removed, still don't see a difference for your 
examples.

        close all
        subplot(2,1,1); plot(rand(10,1)); subplot(2,1,2); plot(rand(10,1))

        close all
        subplot(2,1,1); plot(rand(10,1)); subplot(2,1,2); plot(rand(10,1))
        subplot(2,1,1); plot(rand(10,1)); subplot(2,1,2); plot(rand(10,1))

Ben



reply via email to

[Prev in Thread] Current Thread [Next in Thread]