Remove colorbar border but keep tick labels

8 ビュー (過去 30 日間)
John Cruce
John Cruce 2023 年 8 月 3 日
コメント済み: John Cruce 2023 年 8 月 3 日
I'm needing to remove the outline around my colorbar. When I set the colorbar edgecolor to none (hcb.EdgeColor = 'none'), it does remove the outline, but it also removes my YTickLabels. Any idea why it's doing so and how to maintain my labels while removing the outline around the colorbar?
  2 件のコメント
Shubham
Shubham 2023 年 8 月 3 日
Hi John
Can you try adjusting the LineWidth property of the colorbar's axis?
By setting "hcb.LineWidth" to very small value ,I think you can effectively remove the outline of the colorbar while keeping the tick labels visible. You cannot keep it to 0 because it will give an error. I tried this on my end, but I am not sure if this is what you want to do.
John Cruce
John Cruce 2023 年 8 月 3 日
I did consider this and tried to adjust to a very small value (e.g., hcb.LineWidth=0.000001), but the outline of the colorbar is still pretty apparent in my figure

サインインしてコメントする。

採用された回答

Dyuman Joshi
Dyuman Joshi 2023 年 8 月 3 日
編集済み: Dyuman Joshi 2023 年 8 月 3 日
The closest you can do is turn the outline of the colorbar off. The axis is integrated with ticks and tick labels.
surf(peaks)
c = colorbar;
c.Box = 0;
c.EdgeColor = [0 0.3 0];

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by