How modify the number of rows and columns of plots, when I plot a sbiopredictionci object?

3 views (last 30 days)
When the number of groups are so high, using plot with sbiopredictionci object, it plots all the groups left to righ in a single column, is it possible to change this output?.
Thanks
  4 Comments
Florian Augustin
Florian Augustin on 5 Dec 2023
Hi,
starting in R2023b, the internals of the prediction confidence interval plots have changed and the selectivePlotCI function from my previous comment is not working in R2023b or later releases of MATLAB.
Here is an updated version that works in R2023b or later:
function hFig = selectivePlotCI(ciObj, rowIndices, colIndices)
% Plot confidence intervals to get the data.
ciH = plot(ciObj);
ciH.Visible = false;
cleanupObj = onCleanup(@()close(ciH));
ax = reshape(ciH.Children.Children, ...
[], numel(ciObj(1).ResponseNames))';
numCols = numel(colIndices);
numRows = numel(rowIndices);
% Select axes
selectedAxes = ax(rowIndices, colIndices);
% Create a new figure
hFig = figure;
for i = 1 : numRows
for j = 1 : numCols
% Copy confidence interval plot data to new axes:
subAxes = subplot(numRows, numCols, (i-1)*numCols+j);
copyobj(selectedAxes(i, j).Children, subAxes);
xlabel(selectedAxes(i, j).XLabel.String);
if j == 1
ylabel(ax(rowIndices(i), 1).YLabel.String);
end
if i == 1
title(ax(1, colIndices(j)).Title.String);
end
end
end
end
-Florian

Sign in to comment.

Answers (0)

Communities

More Answers in the  SimBiology Community

Products

Community Treasure Hunt

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

Start Hunting!