import dash from dash import html import holoviews as hv from holoviews.plotting.plotly.dash import to_dash from holoviews.element.tiles import CartoDark from plotly.data import carshare
# Convert from lon/lat to web-mercator easting/northing coordinates df = carshare() df["easting"], df["northing"] = hv.Tiles.lon_lat_to_easting_northing( df["centroid_lon"], df["centroid_lat"] )
# Use plot hook to set the default drag mode to box selection defset_dragmode(plot, element): fig = plot.state fig['layout']['dragmode'] = "select" ifisinstance(element, hv.Histogram): # Constrain histogram selection direction to horizontal fig['layout']['selectdirection'] = "h"