bugGNU Octave - Bugs: bug #52268, 'hold on' interferes with...

 
 

bug #52268: 'hold on' interferes with auto-scaling mechanism for OpenGL toolkits

Submitter:  None
Submitted:  Mon 23 Oct 2017 02:01:07 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Missed Error or Warning
Status:  Duplicate Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 4.2.1
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 06 Nov 2018 01:16:33 PM UTC, comment #12: 

This is a duplicate of bug #48718 which has been fixed. Closing report.

Pantxo Diribarne <pantxo>
Group Member
Mon 13 Nov 2017 05:34:49 PM UTC, comment #11: 

This issue might be related to bug #49167.
There is probably something wrong in axes::properties::sync_positions in graphics.cc that leads to an erroneous "position" property after certain changes.

Markus Mützel <mmuetzel>
Group administrator
Tue 24 Oct 2017 10:48:40 PM UTC, comment #10: 

Yes, the position value looks bonkers.  Interestingly, if I run the failing code, but then set the position value back to its default, the plot looks okay.


scale = 1000;
figure
xlabel a
ylabel b
hold on
plot (rand (20, 1) / scale)
set (gca, 'position', [0.13000   0.11000   0.77500   0.81500])


My new guess is that the behavior is caused by something wrong with the order of callbacks and listeners.  After the plot command, because the axes are set to auto-adjust, there should be a cascade of listeners fired.

Rik <rik5>
Group administrator
Mon 23 Oct 2017 11:15:49 PM UTC, comment #9: 

This looks like an important difference in the axes properties when plotting rand(20,1)/100 versus rand(20,1)/1000 after hold on:


>> get (hax1, "position")
ans =

   0.13000   0.11000   0.77500   0.81500

>> get (hax1, "tightinset")
ans =

   0.042857   0.069058   0.000000   0.023810

>> get (hax2, "position")
ans =

   1.3000e-01   3.5538e+09   7.7500e-01  -7.1076e+09

>> get (hax2, "tightinset")
ans =

   9.8214e-02   3.5538e+09   2.8304e-02   3.5538e+09


All other properties look comparable / sane.

This is the same with gnuplot, even though the axes actually fit in the gnuplot window.

Mike Miller <mtmiller>
Group Member
Mon 23 Oct 2017 10:46:38 PM UTC, comment #8: 

Actually with the gnuplot toolkit I get the warning message from legend, indicating that something in the underlying properties may be behaving the same, but the on-screen rendering in the gnuplot window looks correct. It may be that Octave is doing the same incorrect thing in all toolkits, but gnuplot is compensating for the bad instructions in its on-screen rendering.

Mike Miller <mtmiller>
Group Member
Mon 23 Oct 2017 10:38:39 PM UTC, comment #7: 

As a temporary workaround, even though the syntax is supposed to work, it would be better to plot the data and only afterwards add annotations such as labels and legends.


figure ();
plot
xlabel
ylabel
legend



Rik <rik5>
Group administrator
Mon 23 Oct 2017 10:35:58 PM UTC, comment #6: 

This seems to only be a problem with the OpenGL toolkits.  With gnuplot it works.  This suggests that there might be a problem with the limited resolution (single) of OpenGL versus the doubles that gnuplot uses.  But that might be a red herring.

Rik <rik5>
Group administrator
Mon 23 Oct 2017 08:40:52 PM UTC, comment #5: 

It seems to me the problem has to do with calling "hold on" before plotting any data, then plotting a series that is vastly out of range of the axes that are shown, which already messes up the plot even before legend is called.

For example


>> scale = 1000;
>> figure
>> xlabel a
>> ylabel b
>> hold on
>> plot (rand (20, 1) / scale)


This results in a figure that has a y axis scaled out of proportion and out of the plot area. Calling legend now shows the original warning message, but legend is not really the problem here. It's the interaction between a held axes and the relative scaling of the data that is plotted next.

Mike Miller <mtmiller>
Group Member
Mon 23 Oct 2017 04:33:30 PM UTC, comment #4: 

yes   -- hold on is causing the problem

load xx % loads a data file (attached)
#figure(4)
hold on
xlabel('age')
ylabel('var field')
plot(res(1,:),res(5,:))
legend('b;sim-up;')
hold off


this fails

Doug Stewart <dastew>
Mon 23 Oct 2017 04:16:24 PM UTC, comment #3: 

It is "hold on" that causing the problem.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Mon 23 Oct 2017 04:07:14 PM UTC, comment #2: 

Yes, that works, but my syntax should also be allowed, right?
That's how 'help plot' shows it.

Note that the bug only occurs reliably on a fresh instance.

Mark van Rossum <cosine>
Mon 23 Oct 2017 02:37:11 PM UTC, comment #1: 

is this what you wanted?


load xx % loads a data file (attached)
figure(4)
xlabel('age')
ylabel('var field')
plot(res(1,:),res(5,:))
legend('b;sim-up;')

Doug Stewart <dastew>
Mon 23 Oct 2017 02:01:07 PM UTC, original submission:  

The following script produces a weird warning about division by zero in the legend code.

load xx % loads a data file (attached)
figure(4)
xlabel('age')
ylabel('var field')
hold on
plot(res(1,:),res(5,:),'b;sim-up;')

This produces the warnings
#warning: division by zero
warning: called from
    legend at line 815 column 20
    _plt_ at line 152 column 7
    plot at line 223 column 10
warning: division by zero
warning: called from
    legend at line 900 column 11
    _plt_ at line 152 column 7
    plot at line 223 column 10

In legend.m there is a division by lpos(3) on those lines.

I have been trying to narrow it down, but
interestingly, most variants work ok....


octave-cli -v
GNU Octave, version 4.2.1
I'm using gnuplot but fltk also gives the problem.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #42237:  xx added by None (3KiB - application/octet-stream)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by cosine (Posted a comment)
  • -email is unavailable- added by dastew (Posted a comment)
  •  

    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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-11-06 mtmiller Carbon-CopyRemoved 80942 -
    2018-11-06 pantxo StatusConfirmed Duplicate
        Open/ClosedOpen Closed
    2018-01-31 rik5 Dependencies- bugs #53009 is dependent
    2017-10-23 rik5 SummaryDivision by zero on legend 'hold on' interferes with auto-scaling mechanism for OpenGL toolkits
    2017-10-23 rik5 CategoryPlotting Plotting with OpenGL
    2017-10-23 mtmiller CategoryPlotting with gnuplot Plotting
        StatusNone Confirmed
    2017-10-23 None Attached File- Added xx, #42237

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code