Mercurial > hg > octave-shane
changeset 12398:735e43b75e45
Allow the legend location and orientation to be set without modifying the legend keys (#32374)
author | David Bateman <dbateman@free.fr> |
---|---|
date | Sun, 06 Feb 2011 23:59:37 +0100 |
parents | c60eaf7dac31 |
children | 824b3e0ab12a |
files | scripts/ChangeLog scripts/plot/legend.m |
diffstat | 2 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,7 @@ 2011-02-05 David Bateman <dbateman@free.fr> + * plot/legend.m: Allow the location and orientation to be set without + modifiying the legend keys. * plot/legend.m: Add padding to legend positions. Fix for outerposition for southeastoutside and southwestoutside.
--- a/scripts/plot/legend.m +++ b/scripts/plot/legend.m @@ -288,6 +288,31 @@ if (! isempty (hlegend)) set (hlegend, "box", "off", "visible", "off"); endif + elseif (nargs == 0 && !(strcmp (position, "default") && + strcmp (orientation, "default"))) + if (! isempty (hlegend)) + hax = getfield (get (hlegend, "userdata"), "handle"); + [hplots, text_strings] = __getlegenddata__ (hlegend); + + if (strcmp (position, "default")) + h = legend (hax, hplots, text_strings, "orientation", orientation); + elseif (strcmp (orientation, "default")) + if (outside) + h = legend (hax, hplots, text_strings, "location", + strcat (position, "outside")); + else + h = legend (hax, hplots, text_strings, "location", position); + endif + else + if (outside) + h = legend (hax, hplots, text_strings, "location", + strcat (position, "outside"), "orientation", orientation); + else + h = legend (hax, hplots, text_strings, "location", position, + "orientation", orientation); + endif + endif + endif else hobjects = []; hplots = [];