![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/652815/image.jpeg)
put labels inside colorbar
8 次查看(过去 30 天)
显示 更早的评论
Hello everybody
I would like to write the labels of my colorbar inside the colorbar itself.
So, in other words, to put the numbers -0.4 -0.2 0 0.2 ecc...inside the colorbar (which has a colormap hot, high to right in the image):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/652780/image.png)
Could anyone help me?
Thanks so much!
0 个评论
回答(2 个)
Scott MacKenzie
2021-6-14
Just add tick labels to the colorbar:
plot(rand(1,5));
h = colorbar('northoutside');
h.TickLabels = { -.4 -.3 -.2 -.1 0 .1 .2 .3 .4};
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/652815/image.jpeg)
0 个评论
fransec
2021-6-15
1 个评论
Scott MacKenzie
2021-6-15
Hmm, my misunderstanding. I don't think that's possible unless you put together some klugy glue-code that writes text directly in the figure window.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Colormaps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!