LEGENDGRID(H,string1,...,stringN, numHandlesPerColumn)
numHandlesPerColumn is a 1-by-M matrix with sum(numHandlesPerColumn) = N (number of handles)
The location by default is 'SouthOutside'.
LEGENDGRID(AX, ...)
LEGENDGRID(..., strTitles)
LEGENDGRID(..., 'name1', value1, 'name2', value2, ...)
can use as parameters 'fontSize', 'markerSize' and 'lineWidth'
Examples:
x = 0:.2:12;
h = plot(x,bessel(1,x),x,bessel(2,x),x,bessel(3,x));
str_legend = {'First','Second','Third'};
numHandlesPerColumn = [1 1 1];
lg = legendGrid(h, str_legend, numHandlesPerColumn, ...
'LineWidth', 2, 'fontSize', 20);
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
legendGrid([b,x],'Carrots','Peas','Peppers','Green Beans',...
'Cucumbers','Eggplant', [3 3])
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
legendGrid(b,'Carrots','Peas','Peppers','Green Beans',...
'Cucumbers', [3 2])
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
legendGrid([b,x],'Carrots','Peas','Peppers','Green Beans',...
'Cucumbers','Eggplant', [2 2 2])
Author: Mar Callau Zori
Date: 7/20/2012
version: 1.0
Cite As
Mar Callau-Zori (2023). legendGrid (https://www.mathworks.com/matlabcentral/fileexchange/37583-legendgrid), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |