question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PyDeck example from PyDeck documentation not working

See original GitHub issue

Summary

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

image

In HTML the output of the code below shows the data with tooltips

image

Steps to reproduce

  1. Run the code below
  2. 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:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
MarcSkovMadsencommented, Jan 26, 2020

There is another user with the tooltip problem here. https://discuss.streamlit.io/t/tooltip-and-labels-in-pydeck-chart/1727/2

2reactions
logan0402commented, Nov 13, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found