I need to make a box plot, I am stuck making more than one
2 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
dpb
2018-8-6
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 个评论
dpb
2018-8-6
[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
2018-8-6
编辑:dpb
2018-8-8
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Axis Labels 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!