Effacer les filtres
Effacer les filtres

Subplot 'super' legend

23 vues (au cours des 30 derniers jours)
Ziv Kassner
Ziv Kassner le 1 Oct 2015
Modifié(e) : Adam Danz le 26 Avr 2021
Is there any new function that allows you to create a legend for all subplots?

Réponse acceptée

Luffy
Luffy le 1 Oct 2015
Modifié(e) : Luffy le 1 Oct 2015
  2 commentaires
Ziv Kassner
Ziv Kassner le 1 Oct 2015
I was wondering whether there's a new way... thanks anyway
Adam Danz
Adam Danz le 26 Avr 2021
Actually, Matlab does support a global legend in recent releases.
Another answer on that same page provides a demonstration.

Connectez-vous pour commenter.

Plus de réponses (1)

Victor Castro di Filippo
Victor Castro di Filippo le 26 Avr 2021
Modifié(e) : Victor Castro di Filippo le 26 Avr 2021
Hi. I find this post looking for the same. I found this and works fantastic. Almost 6 years and a pandemic later i hope this works for you. https://www.mathworks.com/matlabcentral/answers/387391-multiple-plots-with-same-legend#answer_309608
On this part you can put your list of string and thats it
legend('show')
  1 commentaire
Adam Danz
Adam Danz le 26 Avr 2021
Modifié(e) : Adam Danz le 26 Avr 2021
This only shows object plotted on the current axes. For example, it doesn't work in this example below. However you can add a global legend by following one of the example in the other answer in the link you shared.
figure
subplot(211)
plot(rand(2,5))
subplot(212)
plot(rand(1,5))
legend('show')

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by