I’m making a scatter plot, and when I set nonselection_fill_color=“fill_color” (which I found here) it throws an error: Bokeh Error attempted to retrieve property array for nonexistent field 'fill_color'
Here’s some of the relevant code if it helps.
p = figure(plot_width=800,
tools=[hover, "save,pan,wheel_zoom,box_zoom,reset,tap"],
x_axis_label=axis_dict[x_axis][0] + (" ($)" if "$" in axis_dict[x_axis] else ""),
y_axis_label=axis_dict[y_axis][0] + (" ($)" if "$" in axis_dict[y_axis] else ""),
title=axis_dict[y_axis][0] + ' vs. ' + axis_dict[x_axis][0] + ' (year ' + ', '.join(
str(year) for year in years) + ')',
)
color_mapper = CategoricalColorMapper(palette=d3['Category10'][9], factors=sectors[1:10])
p.scatter(x_axis,
y_axis,
source=source,
fill_color={'field': 'sector_revised', 'transform': color_mapper},
line_color=None,
legend=field('sector_revised'),
nonselection_fill_color="fill_color",
)
```Please let me know what might be the problem, thanks!`
means that BokehJS will look for a column in the ColumnDataSource literally named "fill_color" to use to supply the colors to use for nonselected glyphs. But evidently your CDS has no such column. Rather, it appears you are applying a transform to some other column named "sector_revised" for standard fill colors. So you could:
* add a "fill_color" column to your CDS
* pass a similar transform on an existing column to nonselection_fill_color
* pass a fixed value like "red" or "#222222" to nonselection_fill_color
I'm making a scatter plot, and when I set nonselection_fill_color="fill_color" (which I found here) it throws an error:
Bokeh Error attempted to retrieve property array for nonexistent field 'fill_color'
Here's some of the relevant code if it helps.
p = figure(plot_width=800,
tools=[hover, "save,pan,wheel_zoom,box_zoom,reset,tap"],
x_axis_label=axis_dict[x_axis][0] + (" (\)" if "" in axis_dict[x_axis] else ""),
y_axis_label=axis_dict[y_axis][0] + (" (\)" if "" in axis_dict[y_axis] else ""),
title=axis_dict[y_axis][0] + ' vs. ' + axis_dict[x_axis][0] + ' (year ' + ', '.join(
str(year) for year in years) + ')',
)
color_mapper = CategoricalColorMapper(palette=d3['Category10'][9], factors=sectors[1:10])
p.scatter(x_axis,
y_axis,
source=source,
fill_color={'field': 'sector_revised', 'transform': color_mapper},
line_color=None,
legend=field('sector_revised'),
nonselection_fill_color="fill_color",
)
Please let me know what might be the problem, thanks!
Il giorno domenica 12 marzo 2017 23:32:17 UTC-4, Bryan Van de ven ha scritto:
Specifying:
nonselection_fill_color="fill_color"
means that BokehJS will look for a column in the ColumnDataSource literally named “fill_color” to use to supply the colors to use for nonselected glyphs. But evidently your CDS has no such column. Rather, it appears you are applying a transform to some other column named “sector_revised” for standard fill colors. So you could:
add a “fill_color” column to your CDS
pass a similar transform on an existing column to nonselection_fill_color
pass a fixed value like “red” or “#222222” to nonselection_fill_color