Editing tick marks figure
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Voss
le 2 Jan 2024
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 commentaire
Voss
le 2 Jan 2024
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);
Voir également
Catégories
En savoir plus sur Install Products dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

