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

조회 수: 23 (최근 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 CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by