-
-
Notifications
You must be signed in to change notification settings - Fork 406
fix: handle 'node_color' in element transformations for Bokeh and MPL #6678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6678 +/- ##
=======================================
Coverage 88.97% 88.97%
=======================================
Files 328 328
Lines 70320 70324 +4
=======================================
+ Hits 62570 62574 +4
Misses 7750 7750 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This pull request has been mentioned on HoloViz Discourse. There might be relevant details there: https://discourse.holoviz.org/t/node-color-parameter-does-not-work-with-sankey/8245/4 |
@@ -653,6 +653,8 @@ def _apply_transforms(self, element, ranges, style): | |||
elif type(element) is Path: | |||
val = np.concatenate([v.apply(el, ranges=ranges, flat=True) | |||
for el in element.split()]) | |||
elif 'node' in k: | |||
val = v.apply(element.nodes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still want to provide the ranges here (and in the bokeh case).
@@ -1838,6 +1838,8 @@ def _apply_transforms(self, element, data, ranges, style, group=None): | |||
ds = Dataset({d.name: v for d, v in self.overlay_dims.items()}, | |||
list(self.overlay_dims)) | |||
val = v.apply(ds, ranges=ranges, flat=True)[0] | |||
elif 'node' in k: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this would be implemented by implementing an overridden _element_transform
method on GraphPlot. Annoyingly though we don't
pass k
through to that method, so for now I guess this is the only thing we can do.
Thanks @epaaso, really appreciate the contribution. A simple test in |
Hey, of course give me 1-2 days! |
Fixes Issue #3835.
To avoid messing with internal as much as possible, I changed the code such that to be able to use this fix with
mpl
you have to define thenodes
object as aDataset
with the column for color as avdim
. Like in this snippet:The
bokeh
parameternode_color
is for a fixed color, so one has to usenode_fill_color
instead:There is an automatic assigning of
cdim
in both the pipeline for these backends and I do not prevent that. I just changed the code so that ifnode_color
is defined, that parameter is given more importance. Maybe a more complete version of this PR would avoid auto-assigningcdim
ifnode_color
is given. But ascdim
is deprecated, I decided to not waste much time looking for the auto-assign.