legend with multiple axes using yyaxis
Mostrar comentarios más antiguos
I am creating a plot with two different y axes. the curves are added alternately. for example:
yyaxis left
plot(A)
yyaxis right
plot(B)
yyaxis left
plot(C)
yyaxis right
plot(D)
My problem is that when I add a legend to the plot, the order of the curves is not the order in which they were created. instead, they are ordered first by the left axis
and then by the right axis. meaning if i write down "legend(A,B,C,D)" the legend entry B will correspond with the curve C and vice-versa. is there a way to fix this? The actual case there are more than 4 curves, and the number changes every time, so manual changing is not possible. many thanks in advance
Nathan
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Graphics Object Properties 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!

