PBrockmann
PBrockmann

Reputation: 429

How to display the grid over tiles in a geo map bokeh plot

Grid is displayed under the tiles. Is there a way to display it over (z-index control) ?

from bokeh.plotting import figure, show
from bokeh.tile_providers import CARTODBPOSITRON, get_provider
from bokeh.models import MercatorAxis, Grid

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")

p.add_layout(MercatorAxis(), 'above')
p.add_layout(MercatorAxis(), 'right')

# possible controls but not visible
p.grid.grid_line_dash = [6, 4]
p.grid.grid_line_alpha = 1
p.grid.grid_line_color = 'gray'

p.add_tile(tile_provider)

show(p)

Upvotes: 0

Views: 334

Answers (2)

mosc9575
mosc9575

Reputation: 6347

I think you are looking for the level value as a keyword argument.

This is the line to change: p.add_tile(tile_provider, level='image') This is the result: enter image description here

firts try

I first modified the alpha value (also a keyword argument). This is the line I changed: p.add_tile(tile_provider, alpha=0.7)

And this is the output:enter image description here

Upvotes: 1

Eugene Pakhomov
Eugene Pakhomov

Reputation: 10727

FWIW, it seems to be the default behavior in Bokeh 2.3. You can try using a development version or just wait till it's released.

Upvotes: 0

Related Questions