Contourf and colormap limits
Afficher commentaires plus anciens
Hi there!
Let's say I want to plot this:
contourf(peaks,16)
caxis([-2 2])
colorbar
Now I get:

But I want to show black contour lines only in the caxis limits AND also the color levels in the same limits, i.e. 16 color levels in [-2 2], not just 6 like in the picture.
Any ideas? Thanks
Réponse acceptée
Plus de réponses (1)
A nice automatic way you can set a similar contour increments and colorbar for two or more figures is:
num_levels = 32;
figure
tiledlayout(1,2, TileSpacing="compact")
nexttile
contourf(x, y, z, num_levels)
colorbar
col_range = clim;
nexttile
contourf(x, y, z, linspace(col_range(1), col_range(2), num_levels))
colorbar
Catégories
En savoir plus sur Contour Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



