Navigation

Operators and Keywords

Function List:

C++ API

legend.m File Reference


Functions

function legend (varargin)[ca
 if (nargs > 0) pos
 if (isnumeric(pos)&&isscalar(pos)&&round(pos)==pos) if(pos >
else error ("legend: invalid position specified")
endif endif endif if (nargs > 1) pos
 if (strcmpi(pos,"location")&&ischar(str)) set(ca
 if (nargs==1) arg
 if (ischar(arg)) if(rows(arg)
 switch (str) case
 set (ca,"key","off")
case show set (ca,"key","on")
 if (strcmpi(val,"on")) set(ca
case boxon set (ca,"key","on","keybox","on")
case boxoff set (ca,"keybox","off")
case left set (ca,"keyreverse","off") nargs--
case right set (ca,"keyreverse","on") nargs--
endif elseif (iscellstr(arg)) varargin
else error ("legend: expecting argument to be a character string")
 if (strcmp(typ,"line")||strcmp(typ,"surface")||strcmp(typ,"patch")||strcmp(typ,"hggroup")) have_data
 while (k > 1 &&!(strcmp(typ,"line")||strcmp(typ,"surface")||strcmp(typ,"patch")||strcmp(typ,"hggroup"))) typ
endwhile if (k > 0) if(strcmp(get(kids(k)
 if (isfield(hgobj,"keylabel")) set(hgkids(j)
endif endfor else set (kids(k),"keylabel", arg)
 if (--k==0) break
endif elseif (!warned) warned
 warning ("legend: ignoring extra labels")
endif endfor if (turn_on_legend) set(ca
endif endfunction!demo!clf !plot (1:10, 1:10, 1:10, fliplr(1:10))
 !title ("incline is blue and decline is green")
!legend("I'm blue","I'm green","location","east")%!demo%!clf%!plot(1 !title ("a very long label can sometimes cause problems")
 !legend ("hello world","location","northeastoutside")%!demo%!clf%!labels
 !set (h,"color", get(gca,"colororder")(i,:))%!labels
 !title ("Signals with random offset and uniform noise")%!xlabel("Sample Nr [k]")
 ylabel ("Amplitude [V]")
 !legend (labels,"location","southoutside")%!legend("boxon")%!demo%!clf%!labels
 !legend (labels{:},"location","southoutside")%!legend("boxon")%!demo%!clf%!x
 !plot (x, x)
 !hold ("on")
 !stem (x, x.^2, 'g')%!legend("linear")
 !hold ("off")
 !plot (x, x, x, x.^2)
 !legend ("linear")
 !legend ("linear","quadratic")
!demo!clf !bar (rand(2, 3))%!ylim([0 1.2])%!legend(

Variables

function varargin = cellstr (arg)
function nargin = __plt_get_axis_arg__ ("legend", varargin{:})
 nargs = nargin
 str = varargin{nargs}
 keypos
endif endif kids = get (ca, "children")
 nkids = numel (kids)
 k = 1
 turn_on_legend = false
case toggle val = get (ca, "key")
 key
 off
 break
endif endfor if(!have_data)
warning("legend setting key
labels has no 
effect
endif endif warned = false
for i
endwhile type
endwhile hggroup hgkids = get (kids(k), "children")
for j
 keylabel
 arg
endif endfor on
 !endfor
!demo!clf !x = linspace (0, 10)
!demo!clf Bar

Function Documentation

!demo ! clf !bar ( rand(2, 3)   ) 

!hold ( "off"   ) 

!hold ( "on"   ) 

!legend ( "linear"  ,
"quadratic"   
)

!legend ( "linear"   ) 

!legend (  ) 

!legend ( labels  ,
"location"  ,
"southoutside"   
)

!legend ( "hello world"  ,
"location"  ,
"northeastoutside"   
)

!plot ( ,
,
,
x.^  2 
)

!plot ( ,
 
)

endif endfunction !demo ! clf !plot ( 1:10  ,
1:10  ,
1:10  ,
fliplr(1:10)   
)

!set ( ,
"color"  ,
get(gca,"colororder")(i,:)   
)

!stem ( ,
x.^  2,
'g'   
)

!title ( "Signals with random offset and uniform noise"   ) 

! legend ("I'm blue", "I'm green", "location", "east") %!demo %! clf %! plot(1 !title ( "a very long label can sometimes cause problems"   ) 

!title ( "incline is blue and decline is green"   ) 

endif elseif ( warned  ) 

endif elseif ( iscellstr(arg)   ) 

endif else error ( "legend: expecting argument to be a character string  ) 

else error ( "legend: invalid position specified"   ) 

endif endfor if ( turn_on_legend   ) 

if ( --  k = =0  ) 

if ( isfield(hgobj,"keylabel")   ) 

endwhile if ( k  ,
 
)

if ( strcmp(typ,"line")||strcmp(typ,"surface")||strcmp(typ,"patch")||strcmp(typ,"hggroup")   ) 

if ( strcmpi(val,"on")   ) 

if ( ischar(arg)   ) 

if ( nargs  = =1  ) 

if ( strcmpi(pos,"location")&&ischar(str)   ) 

endif endif endif if ( nargs  ,
 
)

if ( isnumeric(pos)&&isscalar(pos)&&round(pos)  = =pos  ) 

if ( nargs  ,
 
)

function legend ( varargin   ) 

endif endfor else set ( kids(k ,
"keylabel"  ,
arg   
)

case right set ( ca  ,
"keyreverse"  ,
"on"   
)

case left set ( ca  ,
"keyreverse"  ,
"off"   
)

case boxoff set ( ca  ,
"keybox"  ,
"off"   
)

case boxon set ( ca  ,
"key"  ,
"on"  ,
"keybox"  ,
"on"   
)

case show set ( ca  ,
"key"  ,
"on"   
)

set ( ca  ,
"key"  ,
"off"   
)

switch ( str   ) 

warning ( "legend: ignoring extra labels"   ) 

while ( k  ,
1 &&!  strcmp(typ,"line")||strcmp(typ,"surface")||strcmp(typ,"patch")||strcmp(typ,"hggroup") 
)

ylabel ( "Amplitude "  [V]  ) 


Variable Documentation

!demo ! clf !x = linspace (0, 10)

arg

!demo ! clf Bar

break

endif endfor if (! have_data) warning ("legend setting key labels has no effect

endwhile hggroup hgkids = get (kids(k), "children")

! for i

Initial value:

for j

Initial value:

 1 : length (hgkids)
            hgobj = get (hgkids (j))

k = 1

endif endif kids = get (ca, "children")

function nargin = __plt_get_axis_arg__ ("legend", varargin{:})

nkids = numel (kids)

hold off

hold on

str = varargin{nargs}

case toggle val = get (ca, "key")

otherwise endswitch else varargin = cellstr (arg)

endif endif warned = false