bongbang
bongbang

Reputation: 1712

Style part of glyph

In the minimal example below, how can I highlight, say, the highest point by changing its fill color to red? I know in this case it's easy enough just to draw over the old glyph: p.circle(3, 8, fill_color='red'), but my actual plot is more complicated. So I'm hoping to change something inside the variable r instead, if this is possible.

from bokeh.plotting import figure, output_file, show

output_file("dimensions.html")

p = figure(plot_width=700)
p.plot_height = 300

r = p.circle([1, 2, 3, 4, 5], [2, 5, 8, 2, 7], size=10)

show(p)

Upvotes: 0

Views: 30

Answers (1)

bigreddot
bigreddot

Reputation: 34568

If you want just one circle to be a different color, then there are only two options:

send all the colors:

p.circle(x, y, color=["blue", "blue", "red", "blue", "blue"], size=10) 

Have separate renderers:

p.circle([1, 2, 4, 5], [2, 5, 2, 7], color="blue", size=10)
p.circle(x=3, y=8, color="red", size=10)

There was some exciting new work recently added to GH master to make a start for adding "computed transforms" so in the near future it should be possible to define a custom color mapper for a single glyph, but that functionality does not exist yet as of version 0.11.1

Upvotes: 1

Related Questions