legendbar

Places your items in legend in just same way as they stacked in bar.
1.3K 次下载
更新时间 2005/3/9

无许可证

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')

引用格式

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

MATLAB 版本兼容性
创建方式 R11
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Legend 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0

More shorter