--- C:\Programme_HS\Octave\Octave-4.0.0\share\octave\4.0.0\m\plot\draw\plotyy.m 2015-05-26 19:00:12 +0000 +++ C:\Programme_HS\Octave\Octave-4.0.1\share\octave\4.0.1\m\plot\draw\plotyy.m 2016-06-07 13:21:52 +0000 @@ -112,14 +112,20 @@ h1 = feval (fun1, x1, y1); - set (ax(1), "color", "none", "ycolor", getcolor (h1(1)), "xlim", xlim); - + set (ax(1), "color", "none", "xlim", xlim); + if length(h1) == 1 ## Coloring y-axis only makes sense if plot contains exactly one related line + set (ax(1), "ycolor", getcolor (h1(1))); + endif + set (gcf (), "nextplot", "add"); axes (ax(2)); colors = get (ax(1), "colororder"); - set (ax(2), "colororder", [colors(2:end,:); colors(1,:)]); + off = mod(length(h1), size(colors, 1)); + if off > 0 + set (ax(2), "colororder", [colors(1+off:end,:); colors(1:off,:)]); + endif if (strcmp (get (ax(1), "autopos_tag"), "subplot")) set (ax(2), "autopos_tag", "subplot"); @@ -131,10 +137,12 @@ if (strcmp (get (ax(1), "nextplot"), "replace")) set (ax(2), "nextplot", "replacechildren"); endif - h2 = feval (fun2, ax(2), x2, y2); + 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 length(h2) == 1 ## Coloring y-axis only makes sense if plot contains exactly one related line + set (ax(2), "ycolor", getcolor (h2(1))); + endif if (strcmp (get(ax(1), "activepositionproperty"), "position")) set (ax(2), "position", get (ax(1), "position"));