bugGNU Octave - Bugs: bug #48616, Matlab compatibility for...

 
 

bug #48616: Matlab compatibility for semilogx() and xlim([0 uplim])

Submitted by:  None
Submitted on:  Sun 24 Jul 2016 01:25:37 PM UTC  
 
Category: PlottingSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Franz WankelhuberOriginator Email: -unavailable-
Open/Closed: ClosedRelease: dev
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Tue 12 Sep 2017 05:10:50 PM UTC, comment #11:

This issue is fixed on the development branch with changeset 24030 from bug #43606:
http://hg.savannah.gnu.org/hgweb/octave/rev/ec3d37eeafa2

Markus Mützel <mmuetzel>
Project Member
Fri 14 Oct 2016 11:58:59 AM UTC, comment #10:

It might be too late. But can this still be considered for 4.2.0? It is only a minor fix.

Markus Mützel <mmuetzel>
Project Member
Tue 26 Jul 2016 08:06:42 AM UTC, comment #9:

The underlying difference seems to be deeper in Octave's graphics code than I initially suspected. The following example also fails in Octave but works flawlessly in Matlab:

In Matlab, an "inf" limit seems to indicate a tight axis limit on that border.

Octave does a similar thing when calling the higher level function xlim() with "inf" limits: It manually sets the axis limit on that border that would be used if "(XYZ)LimMode" was set to auto.

The attached changeset does the same for logplots with a "0" border. This prevents the original example from throwing an error. And makes Octave behave more self-consistently, I guess.

However, the underlying difference still persists. Maybe, keep this bug open even if this changeset should be applied. Or open a new bug.

(file #38026)

Markus Mützel <mmuetzel>
Project Member
Mon 25 Jul 2016 05:08:17 PM UTC, comment #8:

That's exactly the issue which seems to be handled a little bit more "gracefully" in Matlab. Matlab seems to omit the boundary point in the plot vector if one x-limit is set to 0 for a semilogx() plot.

Without knowing the exact call stack I'd guess that somewhere before the call to opengl_renderer::draw_axes() a

for the lower bound of the semilogx() plot is calculated.

-Inf as the value for x_min in draw_axes() then triggers the

statement, the warning gets thrown and further plot outputs are cancelled.

Franz Wankelhuber <franzwankel>
Mon 25 Jul 2016 12:25:34 PM UTC, comment #7:

Opps. I over looked the xlim() command. I'm attaching an updated script and figure image.

I now see warnings due to zeroes in xdata and ydata as well as zeros in xlim and ylim.

(file #38020, file #38021)

Ben Abbott <bpabbott>
Project Member
Mon 25 Jul 2016 09:04:47 AM UTC, comment #6:

I can reproduce the original issue from comment #0 with both 4.0.3 and a current tip.
The example fails for qt and fltk with the error message given in comment #0.
For gnuplot, the following error is thrown:

The issue seems to be that there should be a check to the axis limits for logarithmic plots when the axis limit mode is "manual" and one axis limit is set to "0".

I can try and have a look into it if no one else beats me to it.

Markus Mützel <mmuetzel>
Project Member
Mon 25 Jul 2016 01:07:25 AM UTC, comment #5:

I've tried both the default branch and the stable branch. In each case, the script (test_log.m which is attached) produces the output below.

I do not see the warning from libinterp/corefcn/gl-render.cc.

I've attached a png of the figure I get using the qt graphics toolkit.

@Franz, when you see the warning from gl-render.cc are you using the fltk, or qt graphics toolkit? You can check by entering "graphics_toolkit" at Octave's prompt (I don't encounter the error from gl-render.cc for fltk either).

(file #38015, file #38016)

Ben Abbott <bpabbott>
Project Member
Sun 24 Jul 2016 09:03:02 PM UTC, comment #4:

I just found the corresponding code in the online Mercurial browser.

The code throwing the warning is in libinterp/corefcn/gl-render.cc and presumably prepares and draws the axes for the plot window. After the warning a return statement directly follows. So obviously drawing the axes (and the entire following plot graph) seems to stop here, what corresponds to the behaviour I see in Octave: I get an empty plot window without any graph, and on subsequent events in the plot window (onMouseClick, onResize, ...) the warning gets thrown again.

Franz Wankelhuber <franzwankel>
Sun 24 Jul 2016 08:38:31 PM UTC, comment #3:

Ben, I'm using the latest 4.0.3, but I'm running it on Windows 10 64 Bit.

Franz Wankelhuber <franzwankel>
Sun 24 Jul 2016 06:22:50 PM UTC, comment #2:

Thew warning is coming from libinter/corefcn/graphics.cc

Using the default branch, I get the same result as with Matlab. For compatibility, should this warning be removed?

Franz, can you tell us which version of Octave you are using?

Ben Abbott <bpabbott>
Project Member
Sun 24 Jul 2016 05:56:58 PM UTC, comment #1:

I can confirm Matlab's behavior (I recently noticed Matlab's behavior). As a point of clarification, Matlab ignores leading zeros in the data when the corresponding axes scale is 'log'
yields
Iv'e attached the resulting plot.

(file #38006)

Ben Abbott <bpabbott>
Project Member
Sun 24 Jul 2016 01:25:37 PM UTC, original submission:

If you're trying to plot with semilogx and scaling the x-axis with xlim from 0 to some upper value, the lower bound at 0 in xlim causes a

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

warning. No plot output is produced in this case.

Some test code to reproduce the warning:

Matlab seems to avoid the 0 lower limit problem by simply omitting the very first sample in the vector to be plotted.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #38046:  bug48616_log_lim0.patch added by mmuetzel (1KiB - text/x-diff)
file #38020:  test_log_v2.m added by bpabbott (597B - application/octet-stream)
file #38021:  Octave_qt-v2.png added by bpabbott (41KiB - image/png)
file #38015:  test_log.m added by bpabbott (421B - application/octet-stream)
file #38016:  octave_qt.png added by bpabbott (45KiB - image/png)

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mmuetzel (Posted a comment)
  • -unavailable- added by franzwankel (Posted a comment)
  • -unavailable- added by bpabbott (Updated the item)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 14 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 12 Sep 2017 05:10:50 PM UTCmmuetzelStatusPatch Submitted=>Fixed
      Open/ClosedOpen=>Closed
      Release4.0.3=>dev
      Operating SystemMicrosoft Windows=>Any
    Mon 11 Sep 2017 01:41:30 PM UTCmmuetzelAttached File#38026=>Removed
    Mon 30 Jan 2017 10:27:49 PM UTCmmuetzelDependencies-=>Depends on bugs #43606
    Mon 30 Jan 2017 10:22:01 PM UTCmmuetzelStatusNone=>Patch Submitted
    Thu 28 Jul 2016 06:19:11 PM UTCmmuetzelAttached File-=>Added bug48616_log_lim0.patch, #38046
    Tue 26 Jul 2016 08:06:42 AM UTCmmuetzelAttached File-=>Added bug48616_log_lim0.patch, #38026
    Mon 25 Jul 2016 12:25:34 PM UTCbpabbottAttached File-=>Added test_log_v2.m, #38020
      Attached File-=>Added Octave_qt-v2.png, #38021
    Mon 25 Jul 2016 01:07:25 AM UTCbpabbottAttached File-=>Added test_log.m, #38015
      Attached File-=>Added octave_qt.png, #38016
    Sun 24 Jul 2016 05:56:58 PM UTCbpabbottAttached File-=>Added xscale or yscale is log.png, #38006

    Back to the top


    Powered by Savane 3.1-cleanup1