[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #65661] bar plot unable to set individual bar
From: |
Nicholas Jankowski |
Subject: |
[Octave-bug-tracker] [bug #65661] bar plot unable to set individual bar colors |
Date: |
Mon, 29 Apr 2024 17:16:01 -0400 (EDT) |
Follow-up Comment #1, bug #65661 (group octave):
as an example, the following patch vs default would somewhat enable this
capability, although not perfectly:
--- a/scripts/plot/draw/private/__bar__.m Mon Apr 29 16:25:41 2024
-0400
+++ b/scripts/plot/draw/private/__bar__.m Mon Apr 29 17:08:35 2024
-0400
@@ -360,11 +360,15 @@
addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor"));
addproperty ("linestyle", hg, "patchlinestyle", get (h, "linestyle"));
addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth"));
+ addproperty ("cdata", hg, "patchcdata", get (h, "cdata"));
+ addproperty ("facevertexcdata", hg, "patchfacevertexcdata", get (h,
"facevertexcdata"));
addlistener (hg, "edgecolor", @update_props);
addlistener (hg, "facecolor", @update_props);
addlistener (hg, "linestyle", @update_props);
addlistener (hg, "linewidth", @update_props);
+ addlistener (hg, "cdata", @update_props);
+ addlistener (hg, "facevertexcdata", @update_props);
if (isvector (x))
addproperty ("xdata", hg, "data", x);
@@ -495,8 +499,8 @@
function update_props (h, ~)
kids = get (h, "children");
- set (kids, {"edgecolor", "linewidth", "linestyle", "facecolor"},
- get (h, {"edgecolor", "linewidth", "linestyle", "facecolor"}));
+ set (kids, {"edgecolor", "linewidth", "linestyle", "facecolor", "cdata",
"facevertexcdata"},
+ get (h, {"edgecolor", "linewidth", "linestyle", "facecolor", "cdata",
"facevertexcdata"}));
endfunction
function update_data (h, ~)
with that change, the following commands will change face colors in a couple
different ways:
h = bar ([1, 2, 3, 4, 5]);
set (h, 'facevertexcdata', [0 0 0]);
set (h, 'facecolor', 'flat');
set (h, 'facevertexcdata', [0 0 0; 1 0 0; 0 1 0; 0 0 1; 1 1 1]);
set (h, 'facecolor', 'r');
set (h, 'facecolor', 'flat');
i'm not exactly sure why i need to cycle it from 'flat' to something else and
back for it to recognize the facevertexcdata change. also i'm not sure why
it's not looking at cdata, since the patch was defined with (x,y, 'cdata') in
`__bar__`, but it shows the idea.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?65661>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/