How can I lock the colorbar when adding new contour plots?
2 views (last 30 days)
Show older comments
MathWorks Support Team
on 4 Oct 2017
Answered: MathWorks Support Team
on 19 Oct 2017
I am trying to plot multiple matrices using the 'contour' function. I want the colorbar to be fixed after plotting the first matrix. How can I do this?
Accepted Answer
MathWorks Support Team
on 4 Oct 2017
In order to lock the color range after plotting the first matrix, you can use the 'caxis' function. Execute the following two lines of code after the first plot is made.
C=caxis;
caxis([C(1),C(2)])
The first line of code gets the current limits of the color axis. The second line of code explicitly sets the limits of the color axis. Explicitly setting the limits of the color axis should prevent MATLAB from automatically choosing limits on subsequent plots.
0 Comments
More Answers (0)
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!