How to tick a categorical x-axis in errobar plot
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
MarKf
il 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Errorbars in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!