Companion to https://dev.to/andfanilo/streamlit-components-scatterplot-with-selection-using-plotly-js-3d7n
MIT License
Companion code for Dev.to Streamlit components - Scatterplot with selection using Plotly.js
import random
import plotly.express as px
import streamlit as st
from streamlit_scatterplot_selection import st_scatterplot
@st.cache
def random_data():
return random.sample(range(100), 50), random.sample(range(100), 50)
st.subheader("Plotly interactive scatterplot")
x, y = random_data()
fig = px.scatter(x=x, y=y, title="My fancy plot")
v = st_scatterplot(fig)
st.write(v)
cd frontend
npm install
conda create -n streamlit-scatterplot-selection python=3.7
conda activate streamlit-scatterplot-selection
pip install -e .
Both webpack dev server and Streamlit should run at the same time.
cd frontend
set NODE_OPTIONS="--max-old-space-size=8192"
npm run start
streamlit run streamlit_scatterplot_selection/__init__.py