PengPanda / columnlegend

Creates a legend with a specified number of columns

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

columnlegend

Creates a legend with a specified number of columns

columnlegend creates a legend with a specified number of columns.
    
    columnlegend(numcolumns, str, varargin)
        numcolumns - number of columns in the legend
        str - cell array of strings for the legend
        
    columnlegend(..., 'Location', loc)
        loc - location variable for legend, default is 'NorthEast'
                   possible values: 'NorthWest', 'NorthEast', 'SouthEast', 'SouthWest', 
                                    'NorthOutside', 'SouthOutside',
                                    'NortheastOutside', 'SoutheastOutside'
 
    columnlegend(..., 'boxon')
    columnlegend(..., 'boxoff')
         set legend bounding box on/off
 
    example:
       legend_str = []; 
      
            plot(x); hold on; 
            legend_str = [legend_str; {num2str(i)}];
       end
       columnlegend(3, legend_str, 'Location', 'NorthWest');
 
 
    Author: Simon Henin <shenin@gc.cuny.edu>

For example:

subplot(211); 
plot(bsxfun(@times, [0:9]',[1:10])); 
columnlegend(3, cellstr(num2str([1:10]')), 'location','north'); 
subplot(212);
bar(rand(4,3)); 
columnlegend(3,{'yes', 'no', 'maybe'}, 'location', 'northwest');

About

Creates a legend with a specified number of columns

License:BSD 2-Clause "Simplified" License


Languages

Language:MATLAB 100.0%