Mercurial > hg > octave-avbm
changeset 10999:9f45b76c16e3
legend.m: Treat line, patch, and surface objects differetly.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sun, 19 Sep 2010 18:50:30 -0400 |
parents | 728c970a3e7f |
children | 98a31b352aab |
files | scripts/ChangeLog scripts/plot/legend.m |
diffstat | 2 files changed, 24 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,6 @@ 2010-09-19 Ben Abbott <bpabbott@mac.com> + * /plot/legend.m: Treat line, patch, and surface objects differetly. * plot/__go_draw_axes__.m: Remove left over debug code. * miscellaneous/mkoctfile.m: Change help text to be consistent with the shell version.
--- a/scripts/plot/legend.m +++ b/scripts/plot/legend.m @@ -621,27 +621,31 @@ yk = 0; for k = 1 : numel (hplots) hobjects = [hobjects, texthandle (k)]; - color = get (hplots (k), "color"); - style = get (hplots (k), "linestyle"); - if (! strcmp (style, "none")) - l1 = line ("xdata", ([xoffset, xoffset + linelength] + xk * xstep) / lpos(3), - "ydata", [1, 1] .* (lpos(4) - yoffset - yk * ystep) / lpos(4), - "color", color, "linestyle", style); - hobjects = [hobjects, l1]; - endif - marker = get (hplots (k), "marker"); - if (! strcmp (marker, "none")) - l1 = line ("xdata", (xoffset + 0.5 * linelength + xk * xstep) / lpos(3), - "ydata", (lpos(4) - yoffset - yk * ystep) / lpos(4), - "color", color, "marker", marker, - "markeredgecolor", get (hplots (k), "markeredgecolor"), - "markerfacecolor", get (hplots (k), "markerfacecolor"), - "markersize", get (hplots (k), "markersize")); - hobjects = [hobjects, l1]; - endif + switch get (hplots(k), "type") + case "line" + color = get (hplots(k), "color"); + style = get (hplots(k), "linestyle"); + if (! strcmp (style, "none")) + l1 = line ("xdata", ([xoffset, xoffset + linelength] + xk * xstep) / lpos(3), + "ydata", [1, 1] .* (lpos(4) - yoffset - yk * ystep) / lpos(4), + "color", color, "linestyle", style); + hobjects = [hobjects, l1]; + endif + marker = get (hplots(k), "marker"); + if (! strcmp (marker, "none")) + l1 = line ("xdata", (xoffset + 0.5 * linelength + xk * xstep) / lpos(3), + "ydata", (lpos(4) - yoffset - yk * ystep) / lpos(4), + "color", color, "marker", marker, + "markeredgecolor", get (hplots (k), "markeredgecolor"), + "markerfacecolor", get (hplots (k), "markerfacecolor"), + "markersize", get (hplots (k), "markersize")); + hobjects = [hobjects, l1]; + endif + case "patch" + case "surface" + endswitch set (texthandle (k), "position", [(txoffset + xk * xstep) / lpos(3), ... (lpos(4) - yoffset - yk * ystep) / lpos(4)]); - if (strcmp (orientation, "vertical")) yk++; if (yk > num1)