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

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

[Octave-bug-tracker] [bug #58216] bar: stacked bar chart improperly hand


From: A.R. Burgers
Subject: [Octave-bug-tracker] [bug #58216] bar: stacked bar chart improperly handles negative values
Date: Thu, 19 Nov 2020 10:27:01 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36 Edg/86.0.622.69

Follow-up Comment #12, bug #58216 (project octave):

is this correct: http://hg.savannah.gnu.org/hgweb/octave/rev/d2f7fb06bce3

Because now y1p has the sum of squares of y>0 values, whereas in the else
branch y1 has the sum of the y values.


    if (stacked && any (y(:) < 0))
      ypos = (y >= 0);
      yneg = (y <  0);
      ypos = y .* ypos;
      yneg = y .* yneg;

      y1p =  cumsum (y .* ypos, 2);
      y1n =  cumsum (y .* yneg, 2);


The original patch has the sum as well for y1p
https://savannah.gnu.org/bugs/download.php?file_id=50291


+    if (stacked & (any (any (y < 0))))
+      ypos = y .* (y >= 0);
+      yneg = y .* (y < 0);
+
+      y1p =  cumsum (ypos, 2);
+      y1n =  cumsum (yneg, 2);
+      y1 = y1p .* (y >= 0) + y1n .* (y < 0);


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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