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

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

[Octave-bug-tracker] [bug #52135] bar cannot plot two stacked bars


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #52135] bar cannot plot two stacked bars
Date: Sun, 1 Oct 2017 02:14:41 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #21, bug #52135 (project octave):

I actually convinced myself in post #19 that the third version of the
changeset was correct.  :-)

Let's take a step back and think about consistency of the data and its
interpretation (which I think version 3 is most self-consistent).  In version
4, there's this construct:


+  if (isvector (y))
+    if (group)
+      y = y(:);
+    else
+      y = y(:).';
+    endif
+  endif


I think any time the format of the stored data depends on an output property,
such as stacked|grouped, it is precarious because somewhere the consistency is
likely to fail.  [There should be a computer engineering term for such a thing
if there isn't one already (I'm a different branch of engineering)...
something like transmutable data, i.e., the data can represent one form of
presentation or another form of presentation.]

Because all the properties can be altered after the original call to bar(),
it's as if the processing of x and y has to be delayed to the final
subroutine.  If after the fact, I change "barlayout" from a group to a stack,
then we have to be certain that if y(:) is fed back through the bar() routine
it's going to translate to y(:)', even with all the syntax variations.  In
this case, I don't think it does that quite right.  Try this example:


octave:24> h = bar ([3; 4], 'grouped')
h = -6.1875
octave:25> get(h, 'ydata')
ans =

   3
   4

octave:26> set(h, 'barlayout', 'stacked')
octave:27> get(h, 'ydata')
ans =

   3
   4

octave:28> h = bar ([3; 4], 'stacked')
h =

  -6.1261
  -3.3075

octave:29> get(h, 'ydata')
ans =
{
  [1,1] =  3
  [2,1] =  4
}



The first stacked bar graph above is all purple (i.e., a plot of two stacks,
one element per stack), the second is purple and yellow (i.e., a plot of one
stack of two elements).  The original data in both cases was [3; 4], but it
has reached a different result depending on the path we took.

This self-consistency is why I started thinking

bar ([3, 4], 'grouped')
bar ([3, 4], 'stacked')

should be thought of as the equivalent plot, i.e., in both cases the [3, 4] is
the Y of bar(Y,...).

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52135>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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