StackedPlots: Problem by moving Legend out of plot and expand distance between single charts

2 views (last 30 days)
Lukas Hüwe
Lukas Hüwe on 8 May 2022
Answered: dpb on 8 May 2022
Hello,
I use stackedplot to generate 4 plots. I want to move the Legend out of the plot, because it covers data points
ax_090 = findobj(plot_090.NodeChildren, 'Type','Legend');
set(ax_090,'Location','northeastoutside');
doesn't work.
My other Problem is the horizontal distance between the single charts. I can't find Properties to make the distance bigger.

Answers (1)

dpb
dpb on 8 May 2022
The stacked plot is pretty much "what you see is what you get" -- not much is user-variable about the layout -- in particular, for some bizarre reason the legend positions when the plot is stacked plot do not have the 'outsidexxx' options; as you've noted, the 'outside' prefix is ignored.
As is the penchant recently, TMW seems to think they know best and have really neutered many of these lately-introduced specialty graphs.
If you want some more flexibility, you'll probably have to revert to the tiledlayout or the venerable subplot option instead.
Sad, but afaict, true...I couldn't see any way to make the changes you're looking for; particularly with respect to the legend.

Community Treasure Hunt

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

Start Hunting!

Translated by