app designer - how to add multiple x-axes on top and bottom of uiaxes
    16 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Sveta Golod
 il 18 Mag 2020
  
    
    
    
    
    Risposto: Ali BOULGSOA
 il 15 Nov 2022
            I want to display a plot in appdesigner with multiple x-axes and y axes. 
I have a GUI with axes object. I succeeded to add second Y axis by using:
yyaxis(app.UIAxes,'right')
plot(app.UIAxes,.....)
But I can't figure out how to add second x axes.
I was trying to do it similar to the instructions here: https://www.mathworks.com/help/matlab/creating_plots/graph-with-multiple-x-axes-and-y-axes.html
by using: 
ax2 = axes('Position',app.UIAxes.Position,'XAxisLocation','top','YAxisLocation','right','Color','none');
plot(ax2,Iout,yout,'o-r','Parent',ax2)
But it doesn't work, it creates a new figure outside the GUI instead.
2 Commenti
  Anna Sergeeva
 il 17 Mar 2021
				
      Modificato: Anna Sergeeva
 il 17 Mar 2021
  
			Hi
Did you solve your problem?
I am sitting with a similar problem now. I want to plot 16 curves in the same app.UIAxes but with different y-axes.
If I do as described in the accepted answer, I get  an error
 function startupFcn(app)
      app.ax1 = axes(app.UIFigure)
      app.ax2 = axes(app.UIFigure)
      % Do additional processing to add plots to the axes, change positioning, etc.
    end
Best
Anna
Risposta accettata
  Sveta Golod
 il 19 Lug 2020
        2 Commenti
  Gina Abdelhalim
 il 7 Ott 2020
				could you maybe post what your code looks like? I am trying to do it, but i keep getting errors! i would appreciate your help very much
  jonas
      
 il 12 Ott 2020
				I guess ax1 and ax2 are global properties, so if you want to save the handles in app.x then you need to define them first
properties (Access = public)
    ax1
    ax2
end
Più risposte (2)
  Shubh Sahu
    
 il 23 Giu 2020
        I have found few answers similar to your question, Please find their link below:
- https://www.mathworks.com/matlabcentral/answers/91661-is-it-possible-to-plot-the-data-and-show-two-different-scales-for-the-same-data-using-matlab-7-9-r2
- https://www.mathworks.com/matlabcentral/answers/98907-how-can-i-add-a-second-y-axis-with-a-different-scale-in-a-plot-in-matlab-7-9-r2009b
Hope this helps!
  Ali BOULGSOA
 il 15 Nov 2022
        I have found the answer to your question :
                hold(app.UIAxes,'on')
                yyaxis(app.UIAxes,'left')
                loglog(app.UIAxes,Ti,xt)
                app.UIAxes.YLimMode = 'auto';
                app.UIAxes.XLimMode = 'auto';
                app.UIAxes.XScale='log';
                colorbar(app.UIAxes,'off');
                app.UIAxes.XLabel.String ='Time (s)'
                app.UIAxes.YLabel.String = 'Amplitude (%)';  
                yyaxis(app.UIAxes,'right')
                loglog(app.UIAxes,Ti,population)
                app.UIAxes.YLimMode = 'auto';
                app.UIAxes.XLimMode = 'auto';
                colorbar(app.UIAxes,'off');
                app.UIAxes.XLabel.String = 'Time (s)';
                app.UIAxes.YLabel.String = 'Population (%)';
                hold(app.UIAxes,'off')
0 Commenti
Vedere anche
Categorie
				Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





