How to customize Colorbar in heatmap?
32 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
heejin choi
el 16 de En. de 2024
Comentada: heejin choi
el 16 de En. de 2024
I want to change the colorbar ticks and labels.
But in updated heatmap function, the colorbar is not output object of heatmap function.
How can I change the colorbar ticks and label?
In attached figure, I want to change colorbar that has ticks only 0 and 1 and each label will be "No" and "Yes", respectively.
mon_label = ["Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"];
figure(555)
h = heatmap(scedata,'CellLabelColor','none');
Ax = gca;
Ax.XDisplayLabels = mon_label;

0 comentarios
Respuesta aceptada
Angelo Yeo
el 16 de En. de 2024
cdata = [1, 0, 0; 0, 1, 0; 0, 0, 1];
h = heatmap(cdata);
colormap([h.Colormap(1,:); h.Colormap(end,:)]);
hs = struct(h);
hs.Colorbar.Ticks = [0.25, 0.75];
hs.Colorbar.TickLabels = {'False', 'True'};
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Distribution Plots 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!