How to use stackedplot on desired UIAxes at App Designer

42 views (last 30 days)
I want to use stackedplot at my app but I couldn't find a way to plot stackedplot at a specific UIAxes component.
stackedplot(app.A{7,1})
This is the syntax that I am currently using.
Thanks, Mustafa.

Accepted Answer

Dave B
Dave B on 29 Sep 2021
A stackedplot doesn't go in an axes, it's 'equivalent' to an axes in the sense that it goes in a figure or panel or tab. You could make a new stackedplot in your uifigure and set its position to the same as the uiaxes if your goal is to toggle between different types of plots, or use panels (or gridlayout) if your goal is to lay out your stackedplots.
  3 Comments
Dave B
Dave B on 29 Sep 2021
You should be able to pass in the tab (app.Tab1) as the first argument to stackedplot. You'll still need to pass some data in as the stackedplot function requires it (you can use nan if you don't have any data yet), alternatively you could use the lower level matlab.graphics.chart.StackedLineChart('Parent',...) but that may be significantly more difficult.
Here's a demo with a programtically generated app:
u = uifigure;
tg = uitabgroup(u);
t1 = uitab(tg,'Title','Tab1');
t2 = uitab(tg,'Title','Tab2');
stackedplot(t1,rand(10,3))
stackedplot(t2,rand(10,4))
mustafa can Kurt
mustafa can Kurt on 29 Sep 2021
Thank you so much. With the help of your demo, I figured out the idea behind it.

Sign in to comment.

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!