Tiledlayout issues: colorbar title and spacing

65 vues (au cours des 30 derniers jours)
Daniel
Daniel le 21 Oct 2020
Modifié(e) : Dolly More le 17 Juin 2022
I've just discovered tiledlayout. At first, it seemed like a good solution to some of the difficulties with subplot, but I'm finding it comes with it's own difficulties. Here are two issues that I cannot resolve:
1.) If I want a common colorbar on the side for all plots, I cannot get the recommended approach to work: cb = colorbar; cb.Layout.Tile = 'east'; Could this be a version issue? I'm using 2019b. To get around this, I'm using the Position property of the colorbar. The problem now is that the colorbar title is always cut off. When I expand the figure horizontally, that leads to my second issue...
2.) The spacing between the tiles is not fixed, but seems to be proportional to the window size. So, when trying to see my colorbar title by expanding horizontally, the spacing between the figures all gets bigger despite setting it to compact or even none. Similarly, I find that the spacing is not fixed relative to the size of the plot in each tile. That is, when the x axis is longer, the horizontal spacing between tiles is smaller, but when the x axis is shorter, the spacing is large even when set to none.
UPDATE: I've noticed that the tile spacing remains at least more the same if the plot is stretched more or less equally in both directions to maintain its original aspect ratio.
I'd appreciate help on either of these issues if there are known solutions. Thanks.

Réponse acceptée

Adam Danz
Adam Danz le 23 Oct 2020
Modifié(e) : Adam Danz le 24 Oct 2020
"At first, it seemed like a good solution to some of the difficulties with subplot, but I'm finding it comes with it's own difficulties."
True. However, tiledlayout much younger than subplot and still in development.
"1.) If I want a common colorbar on the side for all plots..."
Well, you're in luck if you're able to upgrade to r2020b because this release supports a common colorbar as you describe it. (see release notes). Colorbar and legend positions can be set to 'east','west','north',or 'south'.
tiledlayout(2,2)
nexttile; nexttile; nexttile; nexttile
cb = colorbar;
cb.Layout.Tile = 'east';
Other examples
"2.) The spacing...."
In r2020b we are still unable to set 'Position', 'InnerPosition', 'OuterPosition', or 'ActivePositionProperty' for objects in a TiledChartLayout. However, the improvement mentioned above still helps with the problem you're describing. Colorbar and legend position is more flexible in r2020b.
As for earlier versions, you'll have to use subplot().
  5 commentaires
Adam Danz
Adam Danz le 16 Juin 2022
Great question.
> Does the common colorbar takes into account different colorbar limits of other plots or does it just take the colorbar limit of last plot?
The colorbar responds to the colormap and color limits of the axes/tile it is assigned to. In my demo, it is assigned to the last axes.
> do I have to mention clim after each titled plot
Yes. If you want the colorbar to represent all axes, then all axes should share the same colormap and clim.
Dolly More
Dolly More le 17 Juin 2022
Thank you. That helps!

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by