bugGNU Octave - Bugs: bug #35033, mangled filled contour plot


bug #35033: mangled filled contour plot

Submitted by:  Ben Abbott <bpabbott>
Submitted on:  Sun 11 Dec 2011 06:43:39 PM UTC  
Category:  Plotting 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

Add a New Comment (Rich Markup)

You are not logged in

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


Fri 18 Nov 2016 08:32:48 PM UTC, comment #3: 

I am closing this bug as fixed. The example in comment #1 behaves correctly in the current version of Octave (4.2.0).

The original example still has problems, but they appear to be solely due to bug #37501, because the input data contains NaN values. If I replace all NaNs in the ZI matrix with 0, then the plot appears correct.

Mike Miller <mtmiller>
Project Administrator
Sun 11 Dec 2011 07:20:13 PM UTC, comment #2: 

The approximate correct result may be rendered using "imagesc (z)"

Ben Abbott <bpabbott>
Project Member
Sun 11 Dec 2011 07:14:24 PM UTC, comment #1: 

Another example is below

N = 601;
D = round (N/3);
M = round ((N-1) / 10) + 1;
z1 = rand (M, M);
x1 = 10 * ((1:M) - 1) + 1;
[x1, y1] = meshgrid (x1, x1);

[x, y] = meshgrid (1:N, 1:N);
z = 0.5 * (round (2 * interp2 (x1, y1, z1, x, y)) == 2);

r = min (abs (x - D * round (x / D)), abs (y - D * round (y / D)));
z(r < ceil (D/20)) = 1;

contourf (z)
caxis ([0 1])

Ben Abbott <bpabbott>
Project Member
Sun 11 Dec 2011 06:43:39 PM UTC, original submission:  

This bug was found by Walter White <homerun4711@googlemail.com> on posted to help-octave Octave <Help-octave@octave.org>.

Walter found that Octave mangles the filled contour for his complicated example.

I verified that Octave and Matlab produce similar equivalent results for contour(), so only the filled version is impacted.

I've attached he m-file (walter.m) which may be used to produce the plot. Results for Matlab R2011b and Octave (tip: de90542b7afc) have been attached.

My impression is that the problem is with  _contour_.m

Ben Abbott <bpabbott>
Project Member


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

Attach Files:

Attached Files
file #24563:  my_FEM_matrix.txt added by bpabbott (807KiB - text/plain)
file #24564:  Walter-Octave.png added by bpabbott (302KiB - image/png)
file #24565:  Walter-MATLAB.png added by bpabbott (61KiB - image/png)
file #24562:  walter.m added by bpabbott (617B - application/octet-stream)


   bug dependencies.

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by bpabbott (Submitted the item)

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

    Only project members can vote.




    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-18 mtmiller Dependencies- => Depends on bugs #37501
    2016-11-18 mtmiller StatusNone => Fixed
        Open/ClosedOpen => Closed
    2011-12-11 bpabbott Attached File- => Added walter.m, #24562
        Attached File- => Added my_FEM_matrix.txt, #24563
        Attached File- => Added Walter-Octave.png, #24564
        Attached File- => Added Walter-MATLAB.png, #24565

    Back to the top

    Powered by Savane 3.6