☰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

Bokeh tile renderer wont become visible/invisible based on .visible attribute

Community Support
beder
beder

Hi,

I’m trying to turn on/off renderers in a map using a checkbox and the renderer.visible property.
This works for glyph renderers, but using the same method on tile renderers has no effect.

Help?

⌁   Link to post
_jm
_jm

I was able to reproduce the problem I believe using bokeh server. My version is 2.0.2.

Here’s a minimal example and workaround in one file. Remove the alpha setting logic to reproduce the problem.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""

from bokeh.plotting import figure, curdoc
from bokeh.layouts import column

from bokeh.tile_providers import CARTODBPOSITRON, get_provider
from bokeh.models import Button


tile_provider = get_provider(CARTODBPOSITRON)

# range bounds supplied in web mercator coordinates
p = figure(x_range=(-2000000, 6000000), y_range=(-1000000, 7000000),
           x_axis_type="mercator", y_axis_type="mercator")

r = p.add_tile(tile_provider)


def cb():
    r.visible = not r.visible
    print("cb() INFO visible {:}".format(r.visible))
    if r.visible:
        r.alpha = 1.0
    else:
        r.alpha = 0.0


b = Button()
b.on_click(cb)

curdoc().add_root(column([p,b]))
⌁   Link to post

End of archived discussion · Replies are disabled