Combining Tiled Chart Layouts
33 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
May_the_degrees_of_freedom_be_with_you
le 20 Sep 2021
Commenté : May_the_degrees_of_freedom_be_with_you
le 4 Oct 2021
I am trying to combine 6 line graphs into 1 page. The tiled chart layout function appears perfect for this, but I need separate parent titles for each set of 3 figures. Since sgtitle() operates on the entire layout, it seems like the best method is to create two tiled chart layouts--one 1 X 3 layout for each set of 3 figures. That way, I can create a third tiled chart layout (2 X 1) to stack the two parent figures one on top of the other. This should let me have titles for each figure, titles for each set of three figures, and then a shared legend at the bottom of the page that describes all six figures.
I have successfully created the two 1 X 3 layouts, but I cannot merge them. For example,
Final = tiledlayout(2,1);
nexttile
openfig('Layout1.fig')
nexttile
openfig('Layout2.fig')
Returns an empty figure. If, instead of openfig(), I use the handle for the existing layouts, it returns "handle to deleted TiledChartLayout".
Thank you in advance. I have been buried in the documentation for hours before asking the community.
0 commentaires
Réponse acceptée
Harikrishnan Balachandran Nair
le 23 Sep 2021
Hi,
Tiledlayout creates a tiled chart layout for displaying multiple plots(Axes) in the current figure or specified parent container. In the code you have provided, you are trying to have two figures inside a figure, which is not possible.
In this case, since you are trying to have two tiledlayouts with seperate titles, each of dimension (1,3), you can have two 'panels' defined in the same figure, and have a tiledlayout of dimension 1*3 in each uipanel. You may adjust the position property of the 'uipanel' to achieve the same. The following code might help.
f=figure;
p=uipanel('parent',f);
p2=uipanel('parent',f);
p.Title=("Title1");
p2.Title=("Title2");
p.Position=[0,0.5,1,0.5];
p2.Position=[0,0,1,0.5];
T1=tiledlayout(p,1,3);
T2=tiledlayout(p2,1,3);
nexttile(T1);
nexttile(T1);
nexttile(T1);
nexttile(T2);
nexttile(T2);
nexttile(T2);
You can also have required text boxes in your 'figure' using the 'annotation' function , by setting the 'shapetype' as 'textbox' and changing the 'dim' value to fit to the required position. You may refer to the documentations to get a better idea on setting the properties of the corresponding objects.
You may also refer to a similar question here : https://www.mathworks.com/matlabcentral/answers/736147-add-titles-over-rows-in-subplots
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Title dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!