Code covered by the BSD License  

Highlights from
legendGrid

5.0

5.0 | 1 rating Rate this file 8 Downloads (last 30 days) File Size: 3.51 KB File ID: #37583
image thumbnail

legendGrid

by Mar Callau-Zori

 

20 Jul 2012

LEGENDGRID Display legend in a grid mode.

| Watch this File

File Information
Description

    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

Required Products MATLAB
MATLAB release MATLAB 7.10 (R2010a)
Tags for This File  
Everyone's Tags
figure, grid, legend(2), legendgrid, multileged
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
28 Aug 2012 Mar Callau-Zori

Thanks for your comments, I will take them into account in the next version

21 Jul 2012 Jan Simon

This submission contains an exhaustive help text, but an empty H1-line. A nice example and the screenshot explains the use and the usage very well. The inputs are checked carefully. The code is an example for a clean and clear programming style.

The expression "cellfun(@(x) strcmpi(x, names{i}), varargin_str)" seems to be more complicated as necessary: What about "strcmpi(names{i}, varargin_str)"?

This submission is useful and usable. The screenshot let the FEX users know immediately, if the created output satisfies their needs.

Contact us