MATLAB Answers

Combining Tiled Chart Layouts

조회 수: 5(최근 30일)
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.

채택된 답변

Harikrishnan Balachandran Nair
Harikrishnan Balachandran Nair 2021년 9월 23일
Hi,
I understand that you are trying to have a seperate title for each row in your 'tiledlayout'.
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.
  댓글 수: 1
May_the_degrees_of_freedom_be_with_you
Thank you for your help with this issue, and I apologize for the delay. The code your provided produces a template exactly like what I am looking for, so now all that's left is to figure out centering. It looks like the forum you provided addresses that clearly.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by