Multiple plots in uiaxes in app designer

Hi
I am trying to use multiple UIAxes in in the same UIAxes in app designer. I have a main UIAxes with ticks and labels where I want to plot 16-channel signal. Each channel I want to plot in their own uiaxes, buth without ticks and labels and color. To do so I use this code:
for i = 1:length(app.channel_selected)
app.axes_list(i) = uiaxes(app.RecordingsTab,'Position', app.UIAxes.Position);
set(app.axes_list(i), 'PositionConstraint','innerposition');
set(app.axes_list(i), 'XTick', []);
set(app.axes_list(i), 'YTick', []);
set(app.axes_list(i), 'Color', 'none');
end
But when the signal is plottet, it is plottet outside of the main UIAxes.
How can I alligne these multple UIAxes with the main UIAxes the signals will be shown whithin the main axes? I tried to use 'innerposition', it became better, but still not enough.
Thank you

5 Kommentare

Simon Chan
Simon Chan am 12 Feb. 2022
I think 'Innerposition' should work, could you elaborate more about 'it became better, but still not enough'. What is the meaning of 'still not enough'?
Anna Sergeeva
Anna Sergeeva am 12 Feb. 2022
I mean that the signals are still outside of the main plot. If I did not have the second line in the loop (set(app.axes_list(i), 'PositionConstraint','innerposition');) the plots with signals were even bigger than the main plot.
Simon Chan
Simon Chan am 12 Feb. 2022
I overlooked the 'innerposition' is used for 'PositionConstraint'.
Did you try to set the first and third values on 'InnerPosition' of the channel axis to be the same as the main axis?
ax1.InnerPosition(1) = ax.InnerPosition(1);
ax1.InnerPosition(3) = ax.InnerPosition(3);
where ax is the main axis
Anna Sergeeva
Anna Sergeeva am 12 Feb. 2022
I tryied that. It did not help :-(
Now I add this line in the code
set(app.axes_list(i), 'InnerPosition', app.UIAxes.InnerPosition);
And it works now :-)
Thank you for helping me to reach there.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Cris LaPierre
Cris LaPierre am 12 Feb. 2022

0 Stimmen

I would try using a different approach. Have you looked into stackedplot?
MEP
MEP am 3 Mai 2022

0 Stimmen

I have the same problem Matlab R2020b. The documentation is here but doesn't work. I have used: app.UIAxes2.PositionConstraint = 'innerposition' for my code but the result doesn't work :(

2 Kommentare

Anna Sergeeva
Anna Sergeeva am 3 Mai 2022
Try this
set(app.UIAxes2, 'InnerPosition', app.UIAxes1.InnerPosition);
It helped me :-)
Best
Anna
MEP
MEP am 4 Mai 2022
Many thanks Anna! Now it works! :)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2020b

Gefragt:

am 12 Feb. 2022

Kommentiert:

MEP
am 4 Mai 2022

Community Treasure Hunt

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

Start Hunting!

Translated by