How to tick a categorical x-axis in errobar plot
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have this errorbar with categorical values on the x-axis. I want them in the order like I defined them at "n" but in the plot they are displayed in a different order. Does someone has an idea what to do?
vector_time_correct = [avg_Cortimeminusoutofprep avg_Cortimeminus200 avg_Cortimeminus150 avg_Cortimeminus100 avg_Cortimeminus50]
n = ["out of preparation","-200","-150","-100","-50"]
vector_time = categorical(n)
error_time_vector = [stderror_Cortimeminusoutofprep stderror_Cortimeminus200 stderror_Cortimeminus150 stderror_Cortimeminus100 stderror_Cortimeminus50]
plot(vector_time,vector_time_correct,'-b','LineWidth',3)
hold on
e = errorbar(vector_time,vector_time_correct,error_time_vector,'LineStyle','none','Color','b','CapSize',0,'linewidth',00.1)
hold off
0 commentaires
Réponse acceptée
MarKf
le 1 Nov 2022
Try reordercats
Categoricals are sorted and have an associated order by default that you need to override.
n = ["out of preparation","-200","-150","-100","-50"];
vector_time = categorical(n);
vector_time = reordercats(vector_time,n);
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Errorbars dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!