Nested Axes labels and Data Plotting
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Does anyone know any tricks for doing nested catagorical grouping of plotted data? In the example below of a swarmchart(), I would like to group the categorical names on the x-axis by Group A, B , C, etc.
It would be nice if matlab had a general grouping or stacking function of arbitrary plotted data from tables. In excel, you can easily nest plotted tabular data with pivot table plots like this example. And jmp makes it very easy to group axes or entire plots with thegraph builder. Is anyone aware of built-in functions or tips to achieve my desire?
0 Commenti
Risposte (1)
Sayan
il 30 Ago 2023
My understanding of the question is that multiple categories in a table need to be merged into one category. In MATLAB categories can be merged with "margecats" function. Here is an example of how this can be done.
T = table([1; 2; 3;4;5], {'A'; 'B'; 'C';'D';'E'}, 'VariableNames', {'NumericColumn', 'CategoricalColumn'});
T.CategoricalColumn = categorical(T.CategoricalColumn);
T.CategoricalColumn = mergecats(T.CategoricalColumn, {'A', 'B','C'}, 'ABC');
%% Use the plot function to plot the data with the merged categories column
Further information can be found in the following MATLAB documentation: https://www.mathworks.com/help/releases/R2021a/matlab/ref/categorical.mergecats.html
Hope this helps resolve the query.
0 Commenti
Vedere anche
Categorie
Scopri di più su Tables 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!