boxchart fill color with stripes
8 views (last 30 days)
Show older comments
T is a table of 4 columns: the first Hand (right and left), second Sensor (FLEX, EXT, COMB), third VarName4 (UM,OT) and fourth the numeric value. i would like to differentiate boxes by color and fill (e.g. insert diagonal rows on "OT" type box).
I would like the x-axis to have under each plot UM, OT, UM, OT, UM, OT and in second row FLEX, EXT, COMB.
I would like the data points to appear above the reference boxes and not next to them (see fig).
Thanks in advance for the help.
T.Sensore = categorical(T.Sensore);
T.Hand = categorical(T.Hand);
T.VUCM = log(T.VUCM);
T.VarName4 = categorical(T.VarName4);
figure()
sensore_ordine_desiderato = categorical(T.Sensore(T.Hand == "Left"), {'FLEX', 'EXT', 'COMB'}, 'Ordinal', true);
vucm_ordine_desiderato = categorical(T.VarName4(T.Hand == "Left"), {'UM', 'OT'}, 'Ordinal', true);
boxchart(sensore_ordine_desiderato, T.UM(T.Hand == "Left"), 'GroupByColor', vucm_ordine_desiderato)
hold on
scatter(sensore_ordine_desiderato, T.UM(T.Hand == "Left"), 30, 'k') % 50 è la dimensione dei punti

2 Comments
dpb
on 7 Oct 2023
Edited: dpb
on 7 Oct 2023
I've whined for 30+ years that there's no hatching built into MATLAB HG2, something we had in the 60s and 70s with CalComp pen plotters, even. :( There are some submittals on the FEX, I've not tried any of them in some time now, but when have, they all have had warts of more or less severity; none I've tried so far were really fully satisfying. I've never tried on a boxplot; don't know whether one can get at the low-level patch objects in order to mung on them the way those submittals do or not...
That one may be a toughie....
Answers (0)
See Also
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!