how to label second x and y axes
26 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Rabih Sokhen
il 31 Mar 2021
Commentato: Rabih Sokhen
il 31 Mar 2021
hello guys
in the following code, i don't know how to label the x axis on the top and the y axis that's on the right
anybody have a idea?
thank you
clear all
clc
subplot(2,2,4)
x1 = linspace(0,100,101);
y1 = 2*x1;
x2=3*x1;
y2=4*x1;
plot(x1,y1)
xlabel('x1')
ylabel('y1')
hAx(1)=gca;
hAx(2)=axes('Position',hAx(1).Position,'XAxisLocation','top','xlim',[x2(1) x2(end)],'YAxisLocation','right','ylim',[y2(1) y2(end)],'color','none');
uistack(hAx(2), 'bottom')
0 Commenti
Risposta accettata
Cris LaPierre
il 31 Mar 2021
Use the following syntax with hAx(2) as your target.
plot(1:100)
xlabel('x1')
ylabel('y1')
hAx(1)=gca;
hAx(2)=axes('Position',hAx(1).Position,'XAxisLocation','top','xlim',[0 300],'YAxisLocation','right','ylim',[0 400],'color','none');
uistack(hAx(2), 'bottom')
xlabel(hAx(2),'x2')
ylabel(hAx(2),'y2')
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Axis Labels 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!