Azzera filtri
Azzera filtri

Problem with the legend for the multiple axes.

1 visualizzazione (ultimi 30 giorni)
Hi everyone, I am plotting two graph using multiple axes option, the problem i am having now is with the legend. It is displaying only the first graph but not the for the second graph. I am doing it in this way,
hold on;
ax1 = gca; % current axes
ax2 = axes('Position',ax1_pos,'XAxisLocation','top',...
legend('CABS Channel Usage', 'HBS Channel Usage');
grid on;
axis tight;
hold off;

Risposta accettata

Brendan Hamm
Brendan Hamm il 27 Feb 2015
The axes legend is a child of the axes and therefore it does not know about the line on the other axes. One thing you consider is just using the plotyy(...) function.
  2 Commenti
Aftab Ahmed Khan
Aftab Ahmed Khan il 27 Feb 2015
Hi, thank you for the reply. If i use plotyy function it put my second x-axis on top of the first x-axis. I want one of them to be on the top as they are different from each other.
Aftab Ahmed Khan
Aftab Ahmed Khan il 27 Feb 2015
Modificato: Aftab Ahmed Khan il 27 Feb 2015
Hi, Anyways i manage to do it like this by putting different xlabels and ylabels. Thanks

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by