octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #55002] plotyy: incorrect colororder for 2nd a


From: A.R. Burgers
Subject: [Octave-bug-tracker] [bug #55002] plotyy: incorrect colororder for 2nd axis (with patch)
Date: Sat, 10 Nov 2018 04:01:11 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299

URL:
  <https://savannah.gnu.org/bugs/?55002>

                 Summary: plotyy: incorrect colororder for 2nd axis  (with
patch)
                 Project: GNU Octave
            Submitted by: arb
            Submitted on: Sat 10 Nov 2018 09:01:09 AM UTC
                Category: Plotting
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.4.1
        Operating System: Any

    _______________________________________________________

Details:

In plotyy the lineplots on the 2nd axis have the wrong colororder when the 1st
axis has more than 2 lines. For instance when the first axis has two lines
(default blue and red), the first line on the 2nd axis will be red too.

code to reproduce:


ver = version
hg_id = __octave_config_info__.hg_id
x = linspace(0,10,11)';
[ax, h1, h2] = plotyy(x, [x, x.^2], x, [1-x]);
get([h1;h2], 'color')


without the patch the 2-nd and 3-rd colors returned by get will be the same.
Sample output (with the patch applied:)


ver = 4.4.1
hg_id = 7a7c31b93216+
ans =
{
  [1,1] =  0.00000   0.44700   0.74100
  [2,1] =  0.850000  0.325000  0.098000
  [3,1] =  0.92900   0.69400   0.12500
}


The patch I propose:


diff -r 7a7c31b93216 scripts/plot/draw/plotyy.m
--- a/scripts/plot/draw/plotyy.m        Wed Oct 24 14:58:15 2018 -0700
+++ b/scripts/plot/draw/plotyy.m        Sat Nov 10 09:47:04 2018 +0100
@@ -123,7 +123,7 @@
   axes (ax(2));

   colors = get (ax(1), "colororder");
-  set (ax(2), "colororder", [colors(2:end,:); colors(1,:)]);
+  set (ax(2), "colororder", circshift(colors, -numel(h1), 1));

   if (strcmp (get (ax(1), "__autopos_tag__"), "subplot"))
     set (ax(2), "__autopos_tag__", "subplot");





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55002>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]