How put different colors in different range of values in colorbar?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Avijit Paul
el 8 de Mayo de 2025
Comentada: Avijit Paul
el 9 de Mayo de 2025
Hello All
I want to put different color in different range of values as shown in figure. I am also attching the data set. How to plot this?

0 comentarios
Respuesta aceptada
Cris LaPierre
el 8 de Mayo de 2025
You need to define a colormap with the number of unique colors you want, and then specify the colorbar ticks.
We don't have the data necessary to reproduce your plot, and the data you have shared does not appear to match the values plotted, so here's a rough approximation.
load Data.mat
Z = nan(80,80);
Z(1:length(ensemble_ssp585_plots)) = ensemble_ssp585_plots;
surf(Z)
% Set the colormap to the desired number of colors
C = colormap(jet(8));
% Set the range of values assigned colors
mn = floor(min(ensemble_ssp585_plots));
mx = ceil(max(ensemble_ssp585_plots));
caxis([mn,mx]);
% format the colorbar
colorbar('Ticks',linspace(mn,mx,length(C)+1))
Más respuestas (0)
Ver también
Categorías
Más información sobre Color and Styling en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!