Histogram x axis tick labels – string

42 ビュー (過去 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 Center および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by