-
-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix coloring of SideHistogram in bokeh (#4458)
- Loading branch information
1 parent
bdd4a2d
commit fb8c426
Showing
4 changed files
with
25 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,9 @@ | |
|
||
from bokeh.core.properties import value | ||
from bokeh.document.events import ModelChangedEvent | ||
from bokeh.models import Renderer, Title, Legend, ColorBar, tools | ||
from bokeh.models import ( | ||
ColorBar, ColorMapper, Legend, Renderer, Title, tools | ||
) | ||
from bokeh.models.axes import CategoricalAxis, DatetimeAxis | ||
from bokeh.models.formatters import ( | ||
FuncTickFormatter, TickFormatter, MercatorTickFormatter | ||
|
@@ -1720,12 +1722,17 @@ def _get_colormapper(self, eldim, element, ranges, style, factors=None, colors=N | |
|
||
# Attempt to find matching colormapper on the adjoined plot | ||
if self.adjoined: | ||
cmapper_name = dim_name+name | ||
cmappers = self.adjoined.traverse(lambda x: (x.handles.get('color_dim'), | ||
x.handles.get(name, x.handles.get(cmapper_name)))) | ||
cmappers = [cmap for cdim, cmap in cmappers if cdim == eldim] | ||
cmappers = self.adjoined.traverse( | ||
lambda x: (x.handles.get('color_dim'), | ||
x.handles.get(name), | ||
[v for v in x.handles.values() | ||
if isinstance(v, ColorMapper)]) | ||
) | ||
cmappers = [(cmap, mappers) for cdim, cmap, mappers in cmappers | ||
if cdim == eldim] | ||
if cmappers: | ||
cmapper = cmappers[0] | ||
cmapper, mappers = cmappers[0] | ||
cmapper = cmapper if cmapper else mappers[0] | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rafiyr
via email
Contributor
|
||
self.handles['color_mapper'] = cmapper | ||
return cmapper | ||
else: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -704,7 +704,7 @@ def _compute_group_range(cls, group, elements, ranges, framewise, top_level): | |
dim_name = repr(v) | ||
if dim_name in prev_ranges and not framewise: | ||
continue | ||
values = v.apply(el, expanded=False, all_values=True) | ||
values = v.apply(el, all_values=True) | ||
This comment has been minimized.
Sorry, something went wrong.
philippjfr
Author
Member
|
||
factors = None | ||
if values.dtype.kind == 'M': | ||
drange = values.min(), values.max() | ||
|
I'm seeing exceptions from this line. Should it check if mappers is not empty or should something else have caught that earlier?