How do you remove tick marks (not labels) from a colorbar?

68 ビュー (過去 30 日間)
L'O.G.
L'O.G. 2022 年 9 月 15 日
回答済み: Jonas 2022 年 9 月 15 日
I have a figure plotted with imagesc and the associated colorbar. How do I remove the tick marks from the colorbar?

採用された回答

Star Strider
Star Strider 2022 年 9 月 15 日
Try this —
cm = [1 0 0; 1 1 1; 0 0 1]; % Basic Colormap
cmi = interp1([-2; 0; 5], cm, (-2:5)) % interpolated Colormap
cmi = 8×3
1.0000 0 0 1.0000 0.5000 0.5000 1.0000 1.0000 1.0000 0.8000 0.8000 1.0000 0.6000 0.6000 1.0000 0.4000 0.4000 1.0000 0.2000 0.2000 1.0000 0 0 1.0000
M = randi([-2 5],9) % Matrix
M = 9×9
0 4 -2 2 3 -2 -1 3 -2 5 -1 3 -2 1 -2 4 1 5 4 3 1 0 2 4 0 0 3 5 0 4 2 2 2 5 0 -1 3 3 -1 4 4 5 0 5 0 0 -1 1 3 3 1 3 -1 5 -2 2 3 4 -1 1 4 0 3 3 0 2 1 -1 2 2 -1 3 -1 3 -1 4 -2 -1 3 0 4
figure
imagesc(M)
colormap(cmi)
hcb = colorbar;
figure
imagesc(M)
colormap(cmi)
hcb = colorbar;
hcb.TickLength = 0; % Set TickLength' To 0
See ColorBar Properties for details.
.

その他の回答 (1 件)

Jonas
Jonas 2022 年 9 月 15 日
try
c=colobar;
c.TickLength=0;

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by