How to create a two-line y label for bar plot?

18 ビュー (過去 30 日間)
Duc Tran
Duc Tran 2022 年 1 月 30 日
コメント済み: Duc Tran 2022 年 2 月 9 日
Hi, I have a code below that I use to plot 4 different categories data with label on the y-axis. I want to make each catogory label into 2 lines so that it looks neater when plot and I was wondering how I can do that.
X = categorical({'Energy Consumption', 'Environmental Impact', 'Manufacturing Cost', 'Value of Products'});
y = [1 5.22; 1 3.76; 1 1.61; 1 0.42];
b = barh(X,y);

採用された回答

the cyclist
the cyclist 2022 年 1 月 31 日
There are ideas on how to do this in this answer.
  1 件のコメント
Duc Tran
Duc Tran 2022 年 2 月 9 日
Thank you for your guide, the solution works!

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by