Increase levels on colorbar
38 ビュー (過去 30 日間)
古いコメントを表示
Is there any way to increase or decrease the range of levels on the colorbar ? I plotted a spectrogram, I want to have more levels on the color bar. All I found that I can define the range of the colorbar but not its level. Like I want to have [-140:10:-40] levels but I cannot find any other solution. The image of the color bar is attached![Colorbar.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/251230/Colorbar.png)
![Colorbar.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/251230/Colorbar.png)
2 件のコメント
Adam
2019 年 11 月 28 日
編集済み: Adam
2019 年 11 月 28 日
What do you mean by 'levels'?
You can choose the size of your colourmap.
e.g.
cmap = parula( 1024 );
colormap( hAxes, cmap );
where hAxes is your axes handle. Or if you prefer an adhoc approach just
colormap( cmap )
to apply it to whatever is the currently selected axes.
採用された回答
Adam
2019 年 11 月 29 日
If you create the colourbar and keep its handle, e.g
hColourbar = colorbar( hAxes );
then you can edit the properties of the colourbar, in particular the 'Ticks' property. Or you can just do it all in one go if you knnow beforehand:
colorbar( hAxes, 'Ticks', -140:2:40 )
although I imagine ticks every 2 samples would look a mess with the labels. Every 5 probably ok.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Colormaps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!