Plot with multiple x-axes - same scaling
Mostrar comentarios más antiguos
Hello,
I am currently desperate to try to integrate two x-axes with identical y-axes in a plot ...
I have two problems here:
1.) How can I set the x ticks?
The lower axis should go (exactly) from 6.0 to 7.3 in 0.1 steps.
For the upper axis from 8.7 to 10 also in 0.1 steps. These are 14 points for both of them, but somehow that doesn't fit ...
2.) How can I adjust the x label of the lower axis?
Here my try:
yloss5MHz=[1.97203207600000;3.89411108500000;5.76765474000000;12.9537632700000;22.7141478100000;27.1717289300000;35.3378709500000;36.6057307600000;40.2620933300000;39.0743740300000;33.9838793500000;37.6049696900000;32.0796367400000;36.3937195200000]
yloss10MHz=[28.8049171100000;18.7450177100000;24.2295267100000;25.6980862100000;12.9537632700000;12.9537632700000;7.61531124600000;7.62594681400000;5.76765474000000;1.96074554000000;3.88304584800000;5.76765474000000;3.88304584800000;5.82188362800000]
xf5MHz=[6:0.1:7.3]
xf10MHz=[8.7:0.1:10]
f=figure (1)
ax1 = axes();
ax2 = axes('Position', get(ax1, 'Position'), ...
'XAxisLocation', 'top', ...
'xlim', [8.7 10], ...
'Color', 'none')
linkprop([ax1, ax2], {'ylim', 'Position'});
plot(xf5MHz,yloss5MHz,'Parent',ax1,'Color','k')
hold on
plot(xf10MHz,yloss10MHz,'Parent',ax2,'Color','k')
grid on
grid minor
legend('1f','2f')
xlabel('Frequency [MHz]')
ylabel('Amplitude loss [%]')
Thank you so much!
1 comentario
Mepe
el 24 de Ag. de 2020
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Axes Appearance en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
