☰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

How to manually set window ranges with mercator GPS plot?

Community Supportserverbokeh
Crysers
Crysers

Hi, I wonder if theres a good solution for changing the y_range and x_range of a gps plot.

If I set the x- and y_ranges based on an area I want to show (eg. an area containing all my points in a dataset), there is a wrong spect ratio, which of course makes sense, due to the mercator projection.
If I zoom in and the next higher “zoom-level tile” is loaded, the aspect ration “snaps” to the correct one.
However, I want to have an optimal view right at the beginning, since in some cases, I wont touch the plots, but save them as a file directly.

fig_map = figure(x_range=(-2000000, 6000000), y_range=(-1000000, 7000000),
                x_axis_type="mercator", y_axis_type="mercator")
tile_provider = get_provider(CARTODBPOSITRON_RETINA)
fig_map.add_tile(tile_provider)
show(fig_map)

# somewhere later: This causes a wrong stretching of the map until I manually zoom in.
fig_map.y_range.start = df['Latitude'].min()
fig_map.y_range.end = df['Latitude'].max()
fig_map.x_range.start = df['Longitude'].min()
fig_map.x_range.end = df['Longitude'].max()

Is there a way to somehow pad the axis range to the correct map aspect ratio (which to my understanding should be dependent on the current Latitude value range of the plot)?
Thanks.

⌁   Link to post

End of archived discussion · Replies are disabled