|
From: | Reza Housseini |
Subject: | Re: legend properties |
Date: | Fri, 11 May 2012 15:53:22 +0200 |
When you create the legend, the function returns the handle to the legend.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
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
[Prev in Thread] | Current Thread | [Next in Thread] |