Why do colorbar limits not match the values specified by the CAXIS function in MATLAB 7.0 (R14) when using the CONTOUR or CONTOURF function?

6 views (last 30 days)
When I execute the following commands, the color bar limits do not match those of my contour plot:
contourf(peaks) % contour(peaks)
caxis([-2 2])
colorbar
I expected the color bar limits to range from -2 to 2, however, the limits range from -6 to 8.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This bug has been fixed in Release 14 Service Pack 3 (R14SP3). For previous product releases, read below for any possible workarounds:
A bug in MATLAB 7.0 (R14) causes color axis limits on a graph created using the CONTOUR or CONTOURF functions to be set incorrectly.
To work around this issue, use the CONTOUR/CONTOURF function with the 'v6' switch. For example,
contourf('v6',peaks) % contour('v6',peaks)
caxis([-2 2])
colorbar

More Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!