Scilab Home Page | Wiki | Bug Tracker | Forge | Mailing List Archives | Scilab Online Help | ATOMS
File : Details
Login with GitLab

legends_mc

Displays legends of numerous curves in a MultiColumns bloc
(2550 downloads for this version - 3792 downloads for all versions)
Details
Version
2.0
Author
Samuel Gougeon
Maintainer
Samuel Gougeon
Category
License
Supported Scilab Version
5.0
Creation Date
February 25, 2013
Description
            AVAILABLE FEATURES:
 - Display of legends in a bloc of NL lines or NC columns
 - Traditionnal display over a single column (special case)
 - Display of legends in a single row (special case)
 - Automatic, interactive, or explicit easy positionning.
   Positionning with logarithmic or/and reversed axes is supported.
 - Curves styles extracted from their handles or explicitly provided.
   In the latter case, respective lines thicknesses can be specified 
   (in addition to color, line style, or marker type)
 - Curves belonging to distinct axes can be legended in a common bloc
 - Several blocs of legends can be defined for a given axes
 - Tunable font size
 - Removable frame
 - Extended help displayed with legends_mc()
 - Inline demos

-->legends_mc()

[]= legends_mc(Texts, Styles, Lpc, font_size, thickness, pos, framed?)

 For many curves & related legends, displays a multicolumn bloc of legends:
  - The shape of the bloc can be specified (Lpc)
  - Positionning with Logarithmic or/and reversed axes is supported
  - Lines styles and Markers styles are supported and can be mixed.
    A set of polyline handles or having polyline children can be
    alternatively provided
  - Lines thickness(es) can be specified (ignored if handles are
    given: read out from the polylines properties)

 HELP: run legends_mc() without any parameter
 DEMO: run legends_mc(..) without specifying Texts

 Texts  : vector of legends
 Styles : a) vector of related lines or markers styles (integer indices)
          Styles(i)>0 -> line color (only solid style supported)
          -14<= Styles(i) <=0 -> marker (line overlay unsupported)
         b) (2,n) matrix:
             Styles(1,:) = as in a)
             Styles(2,:) = line style, or color of marker
         c) vector of graphical handles. Then all Polyline children
            are searched (in chronological order of creation).
            Texts must have as many entries as there are available
            polylines.
            If only 1 handle is given and is an axes, the legends is
            set in this axes. When returning, the focus is restored
            to the axes priorly active.
            If a set of handles or an handle not being an axes is given,
            the legends are set in the currently active axes.
         Default Styles : gca()
 Lpc>0 :  (maximal) number of Lines Per Column (integer)
 Lpc<0 : -(maximal) number of Columns per line (integer)
 framed? : boolean: if %T, draws the global box of legends (default)
 pos : position of the block:
      "ur" | 1 : in the upper right corner (default)
      "ul" | 2 : in the upper left corner
      "ll" | 3 : in the lower left corner
      "lr" | 4 : in the lower right corner
      "?"  | 5 : interactive positionning with the mouse
      [xr,yr]: relative coordinates 0 <= xr,yr <= 1 of the upper left
         corner of the block, with respect to the upper left corner
         of the data bounds area. [0,0] is equivalent to "ul"
 thickness: scalar or vector of lines thickness.
            If a vector is provided, its length must = Styles one.
            If styles are from handles, thickness vector is ignored.

 DEMOS: run legends_mc(..) without Texts of legends:
   clf, legends_mc( framed?=%f )
   clf, legends_mc( Lpc=7, pos="?" )
   clf, legends_mc( Lpc=-3, pos="lr" )
   clf, legends_mc( Lpc=-2, pos=[0.15 0.3] )
   clf, legends_mc( font_size=2, pos="ll" )
   clf, legends_mc( pos="?", thickness=2 )
   clf, legends_mc( pos="lr", thickness=1+round(rand(1:19)))
   clf, plot2d(), legends_mc( Lpc=-3, pos="ll" )
   clf, plot(), f=gcf(); legends_mc(Styles=f.children($), pos='?')

 EXAMPLES:
   clf, plot2d(), legends_mc('line #'+string(1:3), Lpc=-1, pos='?' ) // classic
   clf, plot2d(), legends_mc('line #'+string(1:3), Lpc= 1, pos='lr' ) // in row

             
Files (2)
[6.59 kB]
Screenshot
Screenshot for thumbnail
[11.29 kB]
Miscellaneous file
exec() this file. Then run
--> legends_mc()
without input parameters in order to display the help and examples for demo.

* MAKE IT AVAILABLE in EVERY SESSION: Click here to see HOW TO

News (0)
Comments (1)     Leave a comment 
Comment from adrien vogt-schilb -- September 26, 2013, 08:12:41 PM    
This works great as demonstrated! Thank you Samuel

I wish the Styles argument could control polyline_style in addition to already supported
line_style.

Best regards
Leave a comment
You must register and log in before leaving a comment.
Login with GitLab
Email notifications
Send me email when this toolbox has changes, new files or a new release.
You must register and log in before setting up notifications.