필터 지우기
필터 지우기

Xticklabels not labelling appropriate bars in barplot

조회 수: 30 (최근 30일)
Daniel Goldstein
Daniel Goldstein 2022년 3월 24일
댓글: Voss 2022년 3월 24일
I'm trying to label the Xticks on a bar chart to show variable importance. There are 20 variable bars. However, only some are showing xtick labels and they're lininig up with the respective bar. Looks like they're skipping and not aligning.For instance, 'rop' isn't aligned with the first bar despite being the first variable name.
I've tried to expand the figure to a full window but get the same result (second screengrab).
What needs to be done to label each x tick with the respective variable name?

채택된 답변

Voss
Voss 2022년 3월 24일
편집: Voss 2022년 3월 24일
If you're setting the XTickLabel you generally should also be setting the XTick:
h = gca;
h.XTick = 1:20;
h.XTickLabel = Mdlucs.PredictorNames;
  댓글 수: 2
Daniel Goldstein
Daniel Goldstein 2022년 3월 24일
Thank you. That did the trick.
Voss
Voss 2022년 3월 24일
You're welcome!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by