Mercurial > octave
changeset 24294:8a89878ac8bc
plotyy.m: Don't color y-axis which contains more than 1 line object (bug #48115).
* plotyy.m: Check whether number of graphic objects is a scalar, i.e., only one
object before setting "ycolor" property of y-axis.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 23 Nov 2017 09:42:21 -0800 |
parents | 7c5dbc54a899 |
children | 48e7efceb427 |
files | scripts/plot/draw/plotyy.m |
diffstat | 1 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/draw/plotyy.m Thu Nov 23 09:27:23 2017 -0800 +++ b/scripts/plot/draw/plotyy.m Thu Nov 23 09:42:21 2017 -0800 @@ -112,7 +112,11 @@ h1 = feval (fun1, x1, y1); - set (ax(1), "ycolor", getcolor (h1(1)), "xlim", xlim); + set (ax(1), "xlim", xlim); + if (isscalar (h1)) + ## Coloring y-axis only makes sense if plot contains exactly one line + set (ax(1), "ycolor", getcolor (h1)); + endif set (gcf (), "nextplot", "add"); @@ -133,8 +137,12 @@ endif h2 = feval (fun2, x2, y2); - set (ax(2), "yaxislocation", "right", "color", "none", - "ycolor", getcolor (h2(1)), "box", "off", "xlim", xlim); + set (ax(2), "yaxislocation", "right", "color", "none", "box", "off", + "xlim", xlim); + if (isscalar (h2)) + ## Coloring y-axis only makes sense if plot contains exactly one line + set (ax(2), "ycolor", getcolor (h2)); + endif if (strcmp (get(ax(1), "activepositionproperty"), "position")) set (ax(2), "position", get (ax(1), "position"));