Tracking boxplot x axis labels
Afficher commentaires plus anciens
I am using the boxplot function to visualize data in a hierarchical way. Since the function allows me to define the order and hierarchy of the boxes, is there a way I can retrieve the organized tick labels in a string (cell) array?
Example: By changing the order of the strings a,b,c,d (which are the different values associated to the vector_data) the tick labels on the X axis will change. How can I track that change? Can I get a table showing how the x axis tick labels are organized? What is the figure object that has that info?
comp=[a,b,c,d];
boxplot(vector_data(:,1),comp,'FactorGap',[3,1],'PlotStyle','compact','MedianStyle','line','BoxStyle','outline');
Thank you!
2 commentaires
dpb
le 18 Mai 2017
Don't follow the problem; provide a working example that illustrates what you have and what you're trying to accomplish.
Eugenio Daviso
le 19 Mai 2017
Modifié(e) : Eugenio Daviso
le 19 Mai 2017
Réponse acceptée
Plus de réponses (1)
Sangeetha Jayaprakash
le 22 Mai 2017
Modifié(e) : dpb
le 22 Mai 2017
I assume that you are trying to get the ticklabels of the X axis for the attached boxplot. You can get the current axes, and then get the Xticklabels from that handle as shown:
ax = gca;
ticks = ax.Xticklabels
For more information on "gca" function, refer this link:
ERRATUM
Use
ticks = ax.Xticklabel % plural name been removed for singular form
Or, beginning w/ R2016b, there's a new function xticklabels
doc xticklabels % for details if late-enough version
4 commentaires
Eugenio Daviso
le 22 Mai 2017
dpb
le 22 Mai 2017
Well, it isn't boxplots; it's a change in property names--the plural form of '[X|Y|Z]TickLabels' was turned into singular (without the trailing 's')
Eugenio Daviso
le 25 Mai 2017
Modifié(e) : Eugenio Daviso
le 25 Mai 2017
dpb
le 26 Mai 2017
See new Answer that actually addresses original problem...
Catégories
En savoir plus sur Exploration and Visualization dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!