Streaming Map Coordinates in Hover Data When Interacting with Plotly Map


Does anyone know if it is possible to access (latitude, longitude) coordinates that correspond to the current location of the mouse pointer as it hovers over a Plotly map embedded in a Panel application?


1 Like

I believe it will be available in the hover_data parameter of the Plotly pane. See Plotly — Panel v0.14.2 (

I have an example with hover_data here Plotly (

1 Like

Thanks @Marc - I just went down that path to no avail unfortunately. Here’s the example I put together.

from urllib.request import urlopen
import json
with urlopen('') as response:
    counties = json.load(response)

df = pd.read_csv("",
                   dtype={"fips": str})

fig = go.Figure(go.Choroplethmapbox(geojson=counties, locations=df.fips, z=df.unemp,
                                    colorscale="Viridis", zmin=0, zmax=12,
                                    marker_opacity=1, marker_line_width=0))
fig.update_layout(mapbox_style="mapbox://styles/mapbox/light-v10", mapbox_accesstoken=MAPBOX_ACCESS_TOKEN,
                  mapbox_zoom=3.25, mapbox_center = {"lat": 38, "lon": -97})

p = pn.pane.Plotly(fig)
pn.Row(p.controls(), p)

Here’s what I’m seeing in hover data: {“points”: [{“curveNumber”: 0, “pointNumber”: 240, “pointIndex”: 240, “location”: “06109”, “z”: 6.2}]}

Not quite sure what to make of this data.