☰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

Hiding map tiles attribution when multiple tiles renderer are added to the plot

Community Supportcustomjsbokeh
Davide-sd
Davide-sd

Consider the following application, in which the user can choose a tile provider (the logic is implement with Javascript to make this process on the client rather than spending server resources).

All tiles renderers are added when the figure is created, but only the selected tile renderer is visible. However, the attribution box on the figure shows attributions for all tile renderers, even the ones that are currently hidden.

Is there any way to hide tiles attribution when a tile renderer is hidden?

import panel as pn
from bokeh.plotting import figure
pn.extension()

map_selector = pn.widgets.Select(
    name="Tiles",
    options=[
        "OpenStreetMap.Mapnik",
        "OpenTopoMap",
        "CartoDB.Positron",
        "CartoDB.Voyager",
        "Esri.WorldImagery",
    ]
)

p = figure(
    x_axis_type="mercator", 
    y_axis_type="mercator",
    x_range=(1289584.505648815, 1489584.505648815),
    y_range=(5045162.214307019, 5245162.214307019),
)
p.grid.visible = False
p.match_aspect = True

tiles_renderers = {}
for k in map_selector.options:
    tiles_renderers[k] = p.add_tile(k, retina=True)
    tiles_renderers[k].visible = (k == map_selector.value)

map_selector.jscallback(
    args={
        "tiles_renderers": tiles_renderers,
        "map_selector": map_selector,
    },
    value="""
for (const [key, value] of Object.entries(tiles_renderers)) {
  value.visible = (key === map_selector.value)
}
""")

pn.Row(map_selector, p)
⌁   Link to post

End of archived discussion · Replies are disabled