How I connect more legends?

1 Ansicht (letzte 30 Tage)
Dominika
Dominika am 27 Mär. 2017
Beantwortet: Thorsten am 28 Mär. 2017
If I create a plot and then I connect 2 or more plots from different scripts. I want to have legends there about all plots. How I connect legends from more scripts? Thank you
  1 Kommentar
Geoff Hayes
Geoff Hayes am 28 Mär. 2017
Dominika - can you provide an example of when you create a plot and then connect 2 or more plots from different scripts. Do you mean that you just add two or more plots to the axes where you had "drawn" your initial plot? Please clarify.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Thorsten
Thorsten am 28 Mär. 2017
You can use
h(1) = plot(... %your first plot
h(2) = plot(... % your second plot from another script
h(3) = plot(... % your third plot
% ... and so on
And then use
legend(h, {'first', 'second', 'third'}) % add more entries if you have more than three plots

Community Treasure Hunt

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

Start Hunting!

Translated by