Adding a secondary x axis on the top of a line plot
Mostra commenti meno recenti
In the line plot obtained after running the code appended below, xticks are to be added at the top such that their value is 50 times the xticks at the bottom of the plot. Moreover, an xlabel needs to be at the top also. Could someone help me with the code.
I had tried to implement some suggestions in previous posts on the topic, but somehow I get misaligned and overlapping axes. Thanks in advance.
x = 15:15:1800;
y1 = x./(1-x);
y2 = exp(-x./(1+x));
figure;
tiledlayout(1,1);
nexttile;
yyaxis left; plot(x/360,y1,'-bo'); hold on;
ylabel('PCC'); xlabel('time (days)');
yyaxis right; plot(x/360,y2,'-xr'); % hold on;
ylabel('DPCC (mm)'); % xlabel('time (days)');
axis square;
legend('PCC','DPCC','Location','East');
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Axes Appearance in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
