help-octave
[Top][All Lists]
Advanced

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

Re: legend properties


From: Reza Housseini
Subject: Re: legend properties
Date: Fri, 11 May 2012 15:53:22 +0200



On Fri, May 11, 2012 at 3:07 PM, Ben Abbott <address@hidden> wrote:
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



Thanks a lot Ben,

But when I type get(findobj (gca (), "tag", "legend"), "string"), I get an empty cell?
But I found this: get(get(gcf,"children")(1)) 
there I see my string

reply via email to

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