필터 지우기
필터 지우기

Histogram x axis tick labels – string

조회 수: 14 (최근 30일)
Dzerald
Dzerald 2019년 4월 12일
댓글: Dzerald 2019년 4월 12일
Hi,
I've done a simple histogram in Matlab and now I want to change the last tick on x axis. Instead of the "3" number I want string "Others".
How can I do it? I'm at R2015b.
The histogram was done by histogram() function.
hist.jpg

채택된 답변

David Wilson
David Wilson 2019년 4월 12일
Try
>> get(gca,'XTicklabel')
and hack that.
  댓글 수: 2
madhan ravi
madhan ravi 2019년 4월 12일
Please don’t keep adding answers , use comment on this answer.
Dzerald
Dzerald 2019년 4월 12일
This is working, thanks a lot!

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

추가 답변 (2개)

David Wilson
David Wilson 2019년 4월 12일
Hack the final xticklabel
x = randn(1e5,1); x= x-min(x)+1;
histogram(log(x))
xlim([0,3])
xt = xticklabels;
xt{end} = 'other'
xticklabels(xt)
  댓글 수: 1
Dzerald
Dzerald 2019년 4월 12일
편집: Dzerald 2019년 4월 12일
Unfortunately, this isn't working – error ''Undefined function or variable 'xticklabels'."

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


David Wilson
David Wilson 2019년 4월 12일
Released 2016b. What's your version?
>> which xticklabels
C:\Program Files\MATLAB\R2018b\toolbox\matlab\graph3d\xticklabels.m
  댓글 수: 1
Dzerald
Dzerald 2019년 4월 12일
It's 2015b.. Is there any way to do it on this version?

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

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by