Error in contour dependent on number of specified levels

1 view (last 30 days)
I have a matrix named ch1 that contains no inf or nan elements. The matrix has the X label time, and Y label marks. When I try to make a contour plot using:
contour(time,marks, ch1,15,'fill','on');
I get the following error:
Error using patch
Color value contains NaN, or element out of range 0.0 <= value <= 1.0
Error in specgraph.contourgroup/refresh>LdrawFilled (line 403)
cu=patch(xp,yp,clev,'FaceColor','flat','UserData',lev,patchpairs{:});
Error in specgraph.contourgroup/refresh (line 207)
LdrawFilled(this);
Error in specgraph.contourgroup/schema>LdoDirtyAction (line 265)
refresh(h);
The error disappears if I specify 16 or 20 levels rather than 15, but I still get the error when specifying 14 or 10 levels. There is no dependence on XData, YData, or the filled option. This must be some kind of bug in contour, since the error is dependent on the number of contour levels. I could provide the offending matrix if anyone is interested.

Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!