How to properly position multiple plots within app-designer
古いコメントを表示
I use gridlayout to hold each of the plots, but they go wild quickly. In the attachment is a picture of what it looks like. Please pay attention to the two plots on the top right corner.
Why doesn't app-designer allows me to position the plots like I do with subplots within a figure?
8 件のコメント
Ankit
2020 年 1 月 22 日
hows your code looks like?
Mohammad Sami
2020 年 1 月 23 日
If you have the latest matlab r2019b, you can give tiledlayout a try.
Leon
2020 年 1 月 23 日
Many thanks! What is the difference between gridlayout and tiledlayout?
Mohammad Sami
2020 年 1 月 24 日
tiledlayout is specifically for axes. gridlayout can be used with many types of ui elements.
Leon
2020 年 1 月 25 日
Mohammad Sami
2020 年 1 月 25 日
In the Design view, drop a Panel in the position you want to place the tiledlayout.
You will have to create in code. Click code view. Click on AppInputArguments, type in varargin. It will create a startup function.
Click on Property and add a property called tiledlayout. (If you want to access it from workspace, make it public)
Inside the function you can create a tiledlayout, and initialise anything else.
function startupFcn(app, varargin)
app.tiledlayout = tiledlayout(app.Panel);
% do anything else you wish to intialise the app
end
Leon
2020 年 1 月 25 日
Mohammad Sami
2020 年 1 月 26 日
編集済み: Mohammad Sami
2020 年 1 月 26 日
Yes if your gridlayout was only for the axes, you can replace it with a panel as above. If your gridlayout also contains other uielements, you will need to keep it. just place a panel in the gridlayout in the position where you want to put the tiledlayout.
During creation of the tiledlayout you can specify how many tiles you want.
app.tiledlayout = tiledlayout(app.Panel,m,n);
When you are plotting, use the nexttile to get the axes to plot on
tilenum = 1; % last tile = m*n
ax = nexttile(app.tiledlayout,tilenum); % the first argument specifies which layout to plot on
% you might have multiple tiledlayout on multiple tabs. etc.
% plot(ax,)
採用された回答
その他の回答 (2 件)
Lea Corbova
2020 年 10 月 17 日
0 投票
I have similar problem, can you help me please?
3 件のコメント
Leon
2020 年 10 月 17 日
Lea Corbova
2020 年 10 月 17 日
Yes, but without a change. Maybe I added it to wrong place?
pbaspect(axes(ii),'auto'); I added it after plot
elseif T<=20
app.TabGroup.SelectedTab = app.Tab2;
app.Tab2.Scrollable = 'on';
[row,col] = find(app.arrayik==1);
L=length(row);
app.GridLayout=uigridlayout(app.Panel,[(ceil(L/3)) 3]);
A = 120*ones(1,(ceil(L/3)));
app.GridLayout.RowHeight=A;
app.GridLayout.ColumnWidth={'1x','1x','1x'};
for ii=1:L
axes(ii) = uiaxes(app.GridLayout, 'HandleVisibility','on');
set(app.GridLayout,'Scrollable', 'on');
signal=app.record(row(ii),:);
fvz=app.infopoint.samples(row(ii));
NN=length(signal);
cas=((1:NN)/(fvz));
h=plot(axes(ii),cas,signal, 'Color',rand(1,3));
pbaspect(axes(ii),'auto');
title(axes(ii),app.nazvy(row(ii)),'Rotation',0,'FontWeight','bold','Color',h.Color);
end
app.GridLayout.Scrollable = 'on';
Lea Corbova
2020 年 10 月 18 日
編集済み: Lea Corbova
2020 年 10 月 18 日
I already solved this, the problem was with ticks on y axes. I rotate them and the problem was solved. I used:ytickangle(axes(ii),90)
カテゴリ
ヘルプ センター および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!