How I connect more legends?

1 次查看(过去 30 天)
Dominika
Dominika 2017-3-27
回答: Thorsten 2017-3-28
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 个评论
Geoff Hayes
Geoff Hayes 2017-3-28
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.

请先登录,再进行评论。

回答(1 个)

Thorsten
Thorsten 2017-3-28
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

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by