MATLAB: How to do tiledlayout for Boxplots

axisboxplotMATLABnexttileplottiledlayout

I am trying to do a tiledlayout for MATLAB boxplots. My code is:
tiledlayout('flow');
boxplot(randn(10,5));
nexttile;
boxplot(randn(10,5)+5);
nexttile;
boxplot(randn(10,5)-6);
nexttile;
boxplot(randn(10,5));
But I always get the below warnings
Warning: Unable to set 'Position', 'InnerPosition', 'OuterPosition', or
'ActivePositionProperty' for objects in a TiledChartLayout
> In boxplot>renderLabels/setLabelappdata (line 3012)
In boxplot>renderLabels (line 2913)
In boxplot (line 407)
Any clues please?

Best Answer

The boxplot function sets the position of axes (If the axes are not UI axes -> line 3012) and according to the warning, it can not be set for tiled layout. This might be the reason for the warning. If you do not want the warning to show up, you may use
warning('MATLAB:handle_graphics:Layout:NoPositionSetInTiledChartLayout','off')
And for all the plots to be shown, use nexttile before first plot. Refer this example.
tiledlayout('flow');
nexttile;
boxplot(randn(10,5));
Related Question