Contourf and colormap limits
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (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
Categorías
Más información sobre Contour Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



