bugGNU Octave - Bugs: bug #43606, plotting with axis limits at 0

 
 

bug #43606: plotting with axis limits at 0

Submitter:  Matthias Jüschke <maju>
Submitted:  Fri 14 Nov 2014 12:29:20 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Maju 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

Mon 11 Sep 2017 03:43:42 AM UTC, comment #9: 

I checked in the change here (http://hg.savannah.gnu.org/hgweb/octave/rev/ec3d37eeafa2).

I made two changes.  First, when initializing two variables of the same type the Octave coding convention is too put them on separate lines.

Instead of


bool A = true, B = false;


we write


bool A = true;
bool B = false;


Second, I changed the warning IDs to be capitalized, "Octave:...".


Rik <rik5>
Group administrator
Sat 02 Sep 2017 06:21:18 AM UTC, comment #8: 

Rik, thank you for your interest in the patch. I was already working on it.
Attached is a patch which also handles the case where a script would set the upper and lower axis limit to the same value. It also adds some BIST tests.
I did not yet cross check with what Matlab is doing in these cases and won't be able to until the week after next week. Posting the patch in case you think that Matlab compatibility is not so important in these corner cases.

(file #41714)

Markus Mützel <mmuetzel>
Group administrator
Fri 01 Sep 2017 10:42:21 PM UTC, comment #7: 

Bother.  It seems the code base keeps changing before anyone can get to review things.  Could you refresh your patch?  3/5 hunks failed when I tried to apply it today (9/1/17).

Rik <rik5>
Group administrator
Tue 20 Jun 2017 07:49:04 PM UTC, comment #6: 

The patch no longer applies to the current tip. Attached is a refreshed patch.

This patch coincidently also fixes bug #48616 (without the patch provided there). Imho, the patch here is the better one.

(file #40959)

Markus Mützel <mmuetzel>
Group administrator
Tue 03 Jan 2017 08:06:58 AM UTC, comment #5: 

Attached is an alternative patch that moves the checks for Inf limits and limits spanning 0 on logarithmic axes to the graphics backend. With this, setting these limits directly for the axes handle with the "set" function no longer results in an error and gives appropriate warnings.

Additionally, Inf limits are now tight limits for better Matlab compatibility.

I intentionally kept the Octave specific behavior that the adapted (actual) limits are returned when queried (e.g. with "get(gca, 'ylim')").

This change expands a little bit on the original scope of this bug report. I hope it is OK if I post it here.

(file #39353)

Markus Mützel <mmuetzel>
Group administrator
Fri 30 Dec 2016 02:12:41 PM UTC, comment #4: 

Attached is a patch that treats limits that span 0 on logarithmic axes similarly to how Inf limits are treated: the "offending" limit is automatically adjusted.

This is slightly different to what Matlab seems to do. They keep the limits as set in the corresponding property (e.g. "YLim") and only adjust the on-screen limits. They do the same for "Inf".
That means that in Matlab there is no way that I'm aware of to get the actual axis limits. Thus, this difference might be a feature of Octave.

However, we might need to treat Inf and offending limits directly in the graphics backend anyway. They still fail when setting the properties directly rather than using the higher level functions (i.e. "set (gca, 'ylim', [-Inf 1]);" rather than "ylim ([-Inf 1])").

Should I open a new bug report for this or should we continue here?

(file #39331)

Markus Mützel <mmuetzel>
Group administrator
Wed 16 Nov 2016 11:47:58 PM UTC, comment #3: 

Confirmed, there is still a problem in the current development version (4.3.0+) with the Qt toolkit running this example


>> ylim ([-.1, 10])
error: out of memory or dimension too large for Octave's index type
error: called from
    __axis_limits__ at line 56 column 11
    ylim at line 47 column 7
## This error could be improved, and the axes area has disappeared

>> ylim ([0, 10])
error: out of memory or dimension too large for Octave's index type
error: called from
    __axis_limits__ at line 56 column 11
    ylim at line 47 column 7
## Same, the axes area has disappeared, and now this message shows up whenever the mouse enters or leaves the figure window

warning: opengl_renderer: data values greater than float capacity.  (1) Scale data, or (2) Use gnuplot
warning: opengl_renderer: data values greater than float capacity.  (1) Scale data, or (2) Use gnuplot
warning: opengl_renderer: data values greater than float capacity.  (1) Scale data, or (2) Use gnuplot


Using gnuplot, the error message is still present but the plot figure is not affected and the area remains visible and unchanged.

Mike Miller <mtmiller>
Group Member
Tue 17 Nov 2015 10:05:26 PM UTC, comment #2: 

Seems to be solved:



>> x=0:3;
>> plot(x,x.^2)
>> set(gca,'yscale','log')  % plots with ylim 0 to 10 -> ok
warning: axis: omitting non-positive data in log plot
>> ylim([-.1,10])
error: out of memory or dimension too large for Octave's index type
>> ylim([0,10])
%% no change in figure


The only problem  is the line:  "error: out of memory or dimension too large for Octave's index type". It should give the same error as before
"omitting non-positive data in log plot"

Avinoam Kalma <avinoam>
Group Member
Fri 14 Nov 2014 02:43:23 PM UTC, comment #1: 



  My guess is that it is trying to take the log -.1

  try ylim(.1,10) and see  what the plot looks like.

Thanks for your answer. But the bug is not in ylim([-.1,10]) since a correct error message is given. The bug is for ylim([0,10]) where no error message is given and the figure disappears. Of course this is because log(0)=nan, though octave should handle this.
OK now it is clear where the bug is.

Doug Stewart <dastew>
Fri 14 Nov 2014 12:29:20 PM UTC, original submission:  


x=0:3;
plot(x,x.^2)
set(gca,'yscale','log')  % plots with ylim 1 to 10 -> ok
ylim([-.1,10])

error: memory exhausted or requested size too large for range of Octave's index type -- trying to return to prompt
gave an error, plot does not change -> ok

ylim([0,10])

plot disappears, the figure window gets empty, the cursor position is [nan,nan]

Matthias Jüschke <maju>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #41714:  bug43606_log_axis_lims_v4.patch added by mmuetzel (19KiB - application/octet-stream)
file #40959:  bug43606_log_axis_lims_v3.patch added by mmuetzel (19KiB - application/octet-stream)
file #39353:  bug43606_log_axis_lims_v2.patch added by mmuetzel (19KiB - application/octet-stream)
file #39331:  bug43606_log_axis_lims.patch added by mmuetzel (2KiB - application/octet-stream)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mmuetzel (Updated the item)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by avinoam (Posted a comment)
  • -email is unavailable- added by dastew (Posted a comment)
  • -email is unavailable- added by maju (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 13 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-09-11 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2017-09-02 mmuetzel Attached File- Added bug43606_log_axis_lims_v4.patch, #41714
    2017-06-20 mmuetzel Attached File- Added bug43606_log_axis_lims_v3.patch, #40959
        CategoryPlotting with OpenGL Plotting
        Operating SystemGNU/Linux Any
    2017-01-30 mmuetzel Dependencies- bugs #48616 is dependent
    2017-01-03 mmuetzel Attached File- Added bug43606_log_axis_lims_v2.patch, #39353
    2016-12-30 mmuetzel Attached File- Added bug43606_log_axis_lims.patch, #39331
        StatusConfirmed Patch Submitted
    2016-11-16 mtmiller CategoryPlotting with gnuplot Plotting with OpenGL
        StatusNone Confirmed
        Release3.6.4 dev

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code