I need to make a box plot, I am stuck making more than one

3 vues (au cours des 30 derniers jours)
Rebecca Ellis
Rebecca Ellis le 6 Août 2018
Modifié(e) : dpb le 8 Août 2018
I have a time series of numbers 15 min averages of 50 hours. So this is 200 points and need a box plot of every hour, so 4 points for one box plot. Can anyone help with this?

Réponse acceptée

dpb
dpb le 6 Août 2018
boxplot(reshape(date(4,[]))
or, somewhat less cryptic perhaps if you are using an actual timeseries object with calendar times would be to group by day and use the optional second grouping argument to boxplot. Or, of course, since the grouping is fixed and known, you could also create the grouping vector manually.
  9 commentaires
dpb
dpb le 6 Août 2018
[USE COMMENTS for other than actual ANSWER to problem -- dpb]
I' m not sure I have yyaxis - can I download this function?
yyaxis left;
hAxL=gca; % get handle; yyaxis doesn't return is bad design
boxplot(reshape(fluxO2tom01and23,4,[]));
yyaxis right; hAxR=gca; % ditto
plot(o_optode_mean1,1:196)
ylim(hAxL.Ylim); % match up ylim to scale same
linkaxes([hAxL hAxR],'xy'); % keep in synch
Undefined function or variable 'yyaxis'.
dpb
dpb le 6 Août 2018
Modifié(e) : dpb le 8 Août 2018
It's relatively new; R2016a. AFAIK there's no publicly available substitute for the exact syntax.
But, you can "fake it"...
boxplot(reshape(data,4,[])) % create the boxplot for starters
hAx=gca; % hang on to this axes handle
yl=hAx.YLim; ytk=hAx.YTick; % and default range, ticks
hold on % let's not wipe this out
% now plot on top for RH with dummy placeholders for left
[hAx,hL1,hL2]=plotyy(nan,nan,mean(reshape(data,4,[])),'r*');
set(hAx,{'ylim'},{yl},{'ytick'},{ytk})
seems to duplicate effect.
Otherwise, it's not difficult to create the second axes manually if needs be...there's an example in the enhancing graphics section that shows how to do two axes from scratch. Multiple x- and y-axes

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by