Editing tick marks figure
5 次查看(过去 30 天)
显示 更早的评论
I'm trying to add extra tick marks to my figure for percentiles of my sample, but I got a little stuck on how to do it. My current tick marks are coded like this: xt=(0:30000:150000)'; xtl=sprintf('%d |',xt'); set(gca,'xtick',xt) set(gca,'xticklabel',xtl);
Now I would like to add three more tickmarks in (vector) variable PERC and label them respectively P25, P50 and P75. I think it should be easy to adapt xt: xt=[xt;PERC'] . However, I don't understand how to edit variable xtl. Can anybody help me out on how to do it?
0 个评论
回答(1 个)
Voss
2024-1-2
xlim([0 200000])
xt=0:30000:150000;
xtl=compose('%d',xt);
PERC = [45000 100000 130000]; % say
xt=[xt PERC];
xtl=[xtl 'P25' 'P50' 'P75'];
[~,idx] = sort(xt);
xt = xt(idx);
xtl = xtl(idx);
set(gca,'xtick',xt,'xticklabel',xtl);
1 个评论
Voss
2024-1-2
What I would've done in 2012:
xlim([0 200000])
xt=0:30000:150000;
xtl=strtrim(cellstr(num2str(xt(:)))).';
PERC = [45000 100000 130000]; % say
xt=[xt PERC];
xtl=[xtl 'P25' 'P50' 'P75'];
[~,idx] = sort(xt);
xt = xt(idx);
xtl = xtl(idx);
set(gca,'xtick',xt,'xticklabel',xtl);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Install Products 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

