PyDeck example from PyDeck documentation not working
See original GitHub issueSummary
I’ve upgraded to Streamlit 0.53 and wan’t to test out the new st.pydeck_chart
function.
At some stage in my work I wan’t to add tooltips and I cannot make it work. For example the example from the documentation at https://deckgl.readthedocs.io/en/latest/tooltip.html does not work.
In Streamlit the output of the code below does not show the data
In HTML the output of the code below shows the data with tooltips
Steps to reproduce
- Run the code below
- Inspect the browser output
Code
"""Example from https://deckgl.readthedocs.io/en/latest/tooltip.html"""
import streamlit as st
import pydeck as pdk
UK_ACCIDENTS_DATA = (
"https://raw.githubusercontent.com/uber-common/"
"deck.gl-data/master/examples/3d-heatmap/heatmap-data.csv"
)
layer = pdk.Layer(
"HexagonLayer",
UK_ACCIDENTS_DATA,
get_position="[lng, lat]",
auto_highlight=True,
elevation_scale=50,
pickable=True,
elevation_range=[0, 3000],
extruded=True,
coverage=1,
)
# Set the viewport location
view_state = pdk.ViewState(
longitude=-1.415, latitude=52.2323, zoom=6, min_zoom=5, max_zoom=15, pitch=40.5, bearing=-27.36
)
# Combined all of it and render a viewport
r = pdk.Deck(
map_style="mapbox://styles/mapbox/light-v9",
layers=[layer],
initial_view_state=view_state,
tooltip={"html": "<b>Elevation Value:</b> {elevationValue}", "style": {"color": "white"}},
)
r.to_html("test.html", open_browser=True, notebook_display=False)
st.pydeck_chart(r)
- Streamlit version: 0.53
- Python version: 3.7.4
- Using
python -m venv .venv
- OS version: Windows 8.1
- Browser version: Chrome
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Gallery — pydeck 0.8.0b4 documentation
The pydeck library assumes Internet access. You will need an Internet connection or the visualization will not render. Currently, pydeck will not raise...
Read more >Layer Overview and Examples - Pydeck - Read the Docs
Layer represents a kind of data visualization, like a scatterplot or a hexbin chart. The full deck.gl layer catalog is accessible via pydeck....
Read more >Deck — pydeck 0.8.0b4 documentation - Read the Docs
For Mapbox examples, see Mapbox's gallery <https://www.mapbox.com/gallery/> . If not using a basemap, set map_provider=None . initial_view_state (pydeck.
Read more >ScatterplotLayer — pydeck 0.8.0b4 documentation
Adapted from the deck.gl documentation. """ import pydeck as pdk import pandas as pd import math SCATTERPLOT_LAYER_DATA ...
Read more >Event handling — pydeck 0.8.0b4 documentation
pydeck provides bidirectional interactions in Jupyter via event handlers, on_hover , on_resize , on_view_state_change , and on_click .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is another user with the tooltip problem here. https://discuss.streamlit.io/t/tooltip-and-labels-in-pydeck-chart/1727/2
Hi I run into the same issue that while using .show() the background layer is ok but there is no background map layer in the html file I get by .to_html(‘#####.html’) Have you got any solution about this issue? Thanks a lot