help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: legend properties


From: Ben Abbott
Subject: Re: legend properties
Date: Fri, 11 May 2012 09:07:01 -0400

On May 11, 2012, at 2:54 AM, Reza Housseini wrote:

> Hi all,
> 
> how do I get the legend properties like position, frame and text in the 
> figure (or axes) handle?
> 
> Thanks
> Reza

When you create the legend, the function returns the handle to the legend.

        h = legend (...)

You may also obtain the handle by ...

        h = findobj (gca (), "tag", "legend");

The legend object is type "axes" and with 6 unique properties. They are 
"edgecolor", "location", "orientation", "string", "textcolor", and 
"textposition".

edgecolor: sets to color of the box around the legend axes (when boxon is set)

location: is one of "north", "south", "east", "west", "{northeast}", 
"southeast", "northwest", "southwest", "northoutside", "southoutside", 
"eastoutside", "westoutside", "northeastoutside", "southeastoutside", 
"northwestoutside", or "southwestoutside".

orientatation: is either "vertical", or "horizontal".

"string": Is a cell string array containing the strings describing the graphics 
objects.

textcolor: Is the color of the text objects.

textposition: May be "left" or "right" and specifies if the text is to the left 
of right of the graphics objects icons.

You may change the location and text descriptions by ....

        plot (rand (2))
        h = legend ({"foo", "bar"})
        set (h, "location", "west")
        set (h, "string", {"hello", "world"})

Ben




reply via email to

[Prev in Thread] Current Thread [Next in Thread]