How does the Boxplot 'grouporder' parameter work?
31 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am making a boxplot with grouping based on two categorical string/cell variables.
How do I use the 'grouporder' parameter to reorder the second level grouping (m.case) so that vertical order is Case 1, Case 2, Case 1, Case 2.... instead of Case 2, Case 1, Case 2, Case 1, ... ?
Ideally, I'd like to control the first level group order ( 'AV/AVW CHL1', 'GSM CHL1', 'MERIS CHL2') too instead of using 'ydir'.
Here's the existing code:
h = boxplot(m.bias, {m.types, m.case}, 'plotstyle', 'traditional', ... 'labelorientation', 'inline','notch', 'on', 'orientation', 'horizontal',... 'colorgroup', {m.case}, 'colors', [1 0 0 ; 0 .7 0]); set(gca, 'ydir', 'reverse'); ylm = ylim; hold on; plot([0 0], ylm, 'k:');
>> unique(m.types)
ans =
'AV/AVW CHL1'
'GSM CHL1'
'MERIS CHL2'
>> unique(m.case)
ans =
'Case 1'
'Case 2'
0 comentarios
Respuestas (1)
liomsi liomsi
el 24 de En. de 2019
You can convert your m.case to categories, then it should keep the order you gave during the definition of the categories, and you don't need the 'grouporder' option.
m.case = categorical(m.case,{'Case 1','Case 2'}, 'Ordinal',true).
0 comentarios
Ver también
Categorías
Más información sobre Probability Distributions en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!