Is it possible to plot 2 y axis in the appdesigner? It is similar to plotyy in the regular figure. They you can assign the plotting axis yyaxis left/right;

 Respuesta aceptada

Mirek Janda
Mirek Janda el 5 de Abr. de 2018
Editada: Mirek Janda el 11 de Abr. de 2018

10 votos

Easy solution
yyaxis(app.UIAxes,'left')
plot(app.UIAxes,xdata,ydata);
yyaxis(app.UIAxes,'right')
plot(app.UIAxes,xdata,y2data);

4 comentarios

Roman
Roman el 11 de Abr. de 2018
How about setting yyaxis limits properly on left and right side in app designer? Thanks
Mirek Janda
Mirek Janda el 11 de Abr. de 2018
You can create callback on the UIAxis. When it runs it executes the commands...
% Code that executes after component creation
function startupFcn(app)
yyaxis(app.UIAxes,'right')
app.UIAxes.YLabel.String='NAME for your RIGHT Y Axis';
app.UIAxes.YLim = [0 25];
app.UIAxes.YColor = [1 0 0]; % font colour
yyaxis(app.UIAxes,'left')
app.UIAxes.YLabel.String='NAME for your LEFT Y Axis';
app.UIAxes.YLim = [0 100];
app.UIAxes.Color = [1 1 0.8]; % plot box colour
app.UIAxes.XGrid = 'on';
app.UIAxes.YGrid = 'on';
Andrew Davies
Andrew Davies el 17 de Oct. de 2019
this hangs in R2019b on exit or sometimes when the UI elements are changed. Worked finein 2019a.
Jiri Junek
Jiri Junek el 13 de Oct. de 2022
Works on 2022b.

Iniciar sesión para comentar.

Más respuestas (1)

Iurii Medvedev
Iurii Medvedev el 9 de En. de 2019

0 votos

Help me please.
How to use different grids for different axes?

Categorías

Productos

Preguntada:

el 5 de Abr. de 2018

Comentada:

el 13 de Oct. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by