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

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

[Octave-bug-tracker] [bug #59589] default color in bar (and hist) plots


From: Rik
Subject: [Octave-bug-tracker] [bug #59589] default color in bar (and hist) plots is different from Matlab
Date: Fri, 4 Dec 2020 12:12:44 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36

Follow-up Comment #10, bug #59589 (project octave):

It's clear that Matlab took their old function for hist and their new function
for bar charts and just merged them together without much thought.  The syntax
"bar (x)" returns a Bar object while "bar (x, 'hist')" returns an entirely
different object (a Patch object).  Apparently Matlab didn't think much of
their idea either because they no longer recommend using hist() to create
histogram plots.  Instead, the list of Matlab functions
(https://www.mathworks.com/help/matlab/referencelist.html?type=function) now
suggests using histogram() which returns its own special graphics object which
is neither a Bar or Patch object.

I suppose Octave can do the same thing and propagate the mess to our code
base.  This is why it grows tiresome to try and chase Matlab compatibility.

The "FaceColor" property is immaterial here.  The underlying patch object for
a rectangle (bar) has four points.  Matlab chose to specify color data for
each of the four points (they used the same value) and because they had
specified the color at all four points they also needed to tell the OpenGL
renderer how to interpret colors between the points.  For a value of "Flat",
no interpretation is done and the "FaceColor" is taken form the first vertex
of the rectangle.

Octave chose to minimize memory storage and stores just one color for each
rectangles (1/4 of the memory used).  Because there is only one color per
rectangle the OpenGL renderer doesn't need any further instruction, "Flat" or
"Interp", to decide how to proceed.

I'll see what I can do with what we have, but the best course for the future
is probably to implement the histogram() function and deprecate hist().

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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