bugGNU Octave - Bugs: bug #52176, contourf() does not enforce size...


bug #52176: contourf() does not enforce size compatibility

Submitted by:  None
Submitted on:  Fri 06 Oct 2017 11:46:04 AM UTC  
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Missed Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  William Rosenthal Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  4.2.1
Operating System:  Any

Add a New Comment(Rich Markup)

You are not logged in

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


Tue 17 Oct 2017 04:01:47 PM UTC, comment #4:

I checked in a changeset that does stricter validation of inputs for all the contour functions (http://hg.savannah.gnu.org/hgweb/octave/rev/ea06ac500348). This was done on the development branch and will be a part of the next major release (4.4.0). But, because the change is just in an m-file, you can grab the latest copy from the Mercurial repository and put it in your local distribution if you want to see the change immediately.

Rik <rik5>
Project Administrator
Tue 17 Oct 2017 03:21:37 PM UTC, comment #3:

Marking as confirmed. Looks like the input validation needs to be tightened up.

Rik <rik5>
Project Administrator
Tue 17 Oct 2017 12:13:05 PM UTC, comment #2:

Matlab 2016b

Sat 14 Oct 2017 10:26:54 PM UTC, comment #1:

How does Matlab handle the sample code? Does it issue an error or does it choose a padding scheme?

Rik <rik5>
Project Administrator
Fri 06 Oct 2017 11:46:04 AM UTC, original submission:

ERROR: contourf(x,y,f) plots without error an array f which is smaller in at least 1 dimension than the length of the coordinate vectors x and y.

IMPACT: This results in unexpected behavior, because it is not obvious whether the function will pad the plot with white space, pad the array with zeros, or truncate the excessive x or y vector. It also is not obvious whether the function will align the array with the first or last values of the excessive x or y vector. The lack of precise input checking also allows dimension mismatch issues to persist, and makes overall debugging more difficult.

MINIMAL EXAMPLE: This code should, but does not, throw an error citing dimension mismatch between the array A and one or more of the coordinate vectors x and y:

clc, clear all, close all
A = zeros(100,99);
for j = 1:100, for k = 1:99, A(j,k) = j + 2*k; end, end
x = (1:100)';
y = (1:100)';
contourf(y,x,A), colorbar, xlabel('x'), ylabel('y')



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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-10-17 rik5 StatusConfirmed => Fixed
        Open/ClosedOpen => Closed
    2017-10-17 rik5 CategoryPlotting => Octave Function
        StatusNeed Info => Confirmed
        Operating SystemMicrosoft Windows => Any
    2017-10-14 rik5 StatusNone => Need Info

    Back to the top

    Powered by Savane 3.3