☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Changing single glyph's property inside a renderer?

Community Support
mbilyanov
mbilyanov

I have the following simple example, and I would like to reset the colour property of one of the circles to be red, as a separate process, after the renderer is initialised.

from bokeh.plotting import show

x = [2, 4, 8, 5, 9, 3]
y = [4, 8, 2, 7, 4, 6]
id = ['1001', '1002', '1003', '1004', '1005', '1006']

cds = ColumnDataSource(data={'x': x, 'y': y, 'id': id})

p = figure(width=300, height=200)
renderer = p.circle(x='x', y='y', source=cds, size=5, color='green')

# This is my issue?!
#renderer.glyphs[0].color = 'red'

show(p)

I’m aware that I can use the following API to achieve the result, but that is not an option considering what I would like to do next.

selected_circle = Circle(fill_alpha=1, fill_color="firebrick", line_color=None)
nonselected_circle = Circle(fill_alpha=0.2, fill_color="blue", line_color="firebrick")

My intention is to target a specific glyph with a JS callback.

⌁   Link to post
Bryan
Bryan

If you mean that you would like to control the color for individual circles drawn on the screen, then you will need to put the color data in a column in your CDS and use that column to drive the glyph (the same way you do with the “x” and “y” columns for coordinates). Then you can update individual circles by updating the data in the CDS.

⌁   Link to post

End of archived discussion · Replies are disabled