How can I plot polarplot in AppDesigner?

31 views (last 30 days)
Hello, I am making app in Matlab App designer using .m file calculation. In .m file, I wrote polar plot like this:
polarplot(thettar, r)
After that, I have to write and show this in App Designer, but I don't realize how
I tried write like this, but it doesn't work
app.pax = polaraxes(app.UIAxes2);
polarplot(app.pax,thettar,r)

Accepted Answer

Cris LaPierre
Cris LaPierre on 30 Jan 2023
Take a look at this example app.
Create Axes Programmatically
Some graphics functions plot data on specialized axes. For example, functions that plot polar data must do so on a PolarAxes object. Unlike UIAxes objects, which you can add to your app from the Component Library, you must add specialized axes to your app programmatically in your code. To create an axes object programmatically, create a StartupFcn callback for your app. Within it, call the appropriate graphics function and specify a parent container in your app as the target.
Plot on Polar Axes
Functions such as polarplot, polarhistogram, and polarscatter take a polar axes object as a target. Create a polar axes programmatically by calling the polaraxes function. For example, to plot a polar equation in a panel, first drag a panel component from the Component Library onto your canvas. In the code for your app, create the polar axes object by calling the polaraxes function and specifying the panel as the parent container. Then, plot your equation with the polarplot function, specifying the polar axes as the target axes.
theta = 0:0.01:2*pi;
rho = sin(2*theta).*cos(2*theta);
pax = polaraxes(app.Panel);
polarplot(pax,theta,rho)

More Answers (0)

Categories

Find more on Polar Plots in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!