All Projects → domoritz → streamlit-vega-lite

domoritz / streamlit-vega-lite

Licence: MIT license
A Streamlit component to render interactive Vega, Vega-Lite, and Altair visualizations and access the selected data from Python

Programming Languages

python
139335 projects - #7 most used programming language
typescript
32286 projects
Dockerfile
14818 projects
HTML
75241 projects
shell
77523 projects

Projects that are alternatives of or similar to streamlit-vega-lite

covidviz
Professional visualizations of COVID-19, emulating NYT, The Guardian, Washington Post, The Economist & others, using only Python & Altair.
Stars: ✭ 24 (-59.32%)
Mutual labels:  vega, vega-lite, altair
flasked-altair
Altair/Vega-Lite + Flask for easy web visuals
Stars: ✭ 50 (-15.25%)
Mutual labels:  vega, vega-lite, altair
visualisation-lab
An experimental visualisation workbench built using Svelte
Stars: ✭ 17 (-71.19%)
Mutual labels:  vega, vega-lite
tensorflow-stack-ts
TensorFlow.js Full-Stack Starter Kit
Stars: ✭ 33 (-44.07%)
Mutual labels:  vega, vega-lite
Vega Lite
A concise grammar of interactive graphics, built on Vega.
Stars: ✭ 3,568 (+5947.46%)
Mutual labels:  vega, vega-lite
xrig
High performance cryptonight miner for AMD cards. Designed for large-scale use of RX Vega.
Stars: ✭ 23 (-61.02%)
Mutual labels:  vega
arrow-datafusion
Apache Arrow DataFusion SQL Query Engine
Stars: ✭ 2,360 (+3900%)
Mutual labels:  arrow
Pointy
A jQuery plugin that dynamically points one element at another ~
Stars: ✭ 25 (-57.63%)
Mutual labels:  arrow
datasette-dashboards
Datasette plugin providing data dashboards from metadata
Stars: ✭ 65 (+10.17%)
Mutual labels:  vega-lite
hood
The plugin to manage benchmarks on your CI
Stars: ✭ 17 (-71.19%)
Mutual labels:  arrow
gpdvega
gpdvega is a bridge between GeoPandas and Altair that allows to seamlessly chart geospatial data
Stars: ✭ 49 (-16.95%)
Mutual labels:  altair
terminus-altair
Elegant customizable theme with vivid colors for Terminus
Stars: ✭ 26 (-55.93%)
Mutual labels:  altair
tooltip
[DEPRECATED] The tooltip that has all the right moves
Stars: ✭ 133 (+125.42%)
Mutual labels:  arrow
nl4dv
A python toolkit to create Visualizations (Vis) using natural language (NL) or add an NL interface to existing Vis.
Stars: ✭ 63 (+6.78%)
Mutual labels:  vega-lite
avit-da2k
💲 oh-my-zsh theme based on avit theme
Stars: ✭ 15 (-74.58%)
Mutual labels:  arrow
bow
Go data analysis / manipulation library built on top of Apache Arrow
Stars: ✭ 20 (-66.1%)
Mutual labels:  arrow
covid19-italy
Quick streamlit dashboard to visualise the impact of COVID-19 in Italy
Stars: ✭ 24 (-59.32%)
Mutual labels:  altair
arrow-fx
Λrrow Fx is part of Λrrow, a functional companion to Kotlin's Standard Library
Stars: ✭ 64 (+8.47%)
Mutual labels:  arrow
vinum
Vinum is a SQL processor for Python, designed for data analysis workflows and in-memory analytics.
Stars: ✭ 57 (-3.39%)
Mutual labels:  arrow
polars
Fast multi-threaded DataFrame library in Rust | Python | Node.js
Stars: ✭ 6,368 (+10693.22%)
Mutual labels:  arrow

Streamlit Vega-Lite

code style black PyPI - Downloads

🐉 Here be dragons. This is a proof of concept.

Making Vega-Lite selection created by user interactions available in Python. Works with Altair.

For examples, see https://github.com/domoritz/streamlit-vega-lite/blob/master/streamlit_vega_lite/__init__.py. You can also try the demo at https://github.com/domoritz/streamlit-vega-lite-demo.

Demo screencast

Documentation

Installation

pip install streamlit-vega-lite

Usage

There are two functions available. vega_lite_component expects a Vega-Lite specification as a dictionary and any named datasets as keyword arguments. The datasets will be transferred as efficient Arrow tables. altair_component supports Altair charts and automatically extracts all datasets and transfers them as Arrow dataframes.

Example

import altair as alt
import streamlit as st
import pandas as pd
import numpy as np

from streamlit_vega_lite import vega_lite_component, altair_component

hist_data = pd.DataFrame(np.random.normal(42, 10, (200, 1)), columns=["x"])

@st.cache
def altair_histogram():
    brushed = alt.selection_interval(encodings=["x"], name="brushed")

    return (
        alt.Chart(hist_data)
        .mark_bar()
        .encode(alt.X("x:Q", bin=True), y="count()")
        .add_selection(brushed)
    )

event_dict = altair_component(altair_chart=altair_histogram())

r = event_dict.get("x")
if r:
    filtered = hist_data[(hist_data.x >= r[0]) & (hist_data.x < r[1])]
    st.write(filtered)

Dev Setup

Open two terminals in the dev container using VSCode's Remote Containers Extension.

In the first terminal, run:

# Install python module in editable mode
pip install -e .

# Launch streamlit app
streamlit run streamlit_vega_lite/__init__.py

In the second terminal:

# Switch to location of frontend code
cd streamlit_vega_lite/frontend
# Install dependencies
yarn
# Launch frontend assets
yarn start

Then open http://localhost:8501/.

Style

Run Black for Python formatting.

black . -l 120

Run Prettier for other formatting in the frontend directory.

yarn format

Publish

See https://docs.streamlit.io/en/stable/publish_streamlit_components.html.

Make sure that _RELEASE is set to True.

pushd streamlit_vega_lite/frontend
yarn build
popd
python setup.py sdist bdist_wheel
python3 -m twine upload --repository pypi dist/*
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].