legendbar

Places your items in legend in just same way as they stacked in bar.
1,3K Downloads
Aktualisiert 9. Mär 2005

Keine Lizenz

LEGENDBAR places your items in legend in just same way as they stacked in bar, from the first item at lowest place up to last item at highest place.

Don't forget to write the corresponding strings in opposite order as well!

Example: the same as in "help legend"

but here legend looks much nicer:

x = 0:.2:12;
plot(x,bessel(1,x),x,bessel(2,x),x,bessel(3,x));
legend('First','Second','Third');
legend('First','Second','Third',-1)

b = bar(rand(10,5),'stacked'); colormap(summer); hold on
x = plot(1:10,5*rand(10,1),'marker','square','markersize',12,...
'markeredgecolor','y','markerfacecolor',[.6 0 .6],...
'linestyle','-','color','r','linewidth',2); hold off
legend([legendbar(b),x],'Cucumbers','Green Beans','Peppers',...
'Peas','Carrots','Eggplant')

Zitieren als

Isabella Osetinsky-Tzidaki (2024). legendbar (https://www.mathworks.com/matlabcentral/fileexchange/6938-legendbar), MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R11
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Legend finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
1.0.0.0

More shorter