streamlit-label-graph
Plotly graph for labelling timeserie data
pip install streamlit-label-graph
import streamlit as st
import pandas as pd
import numpy as np
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from streamlit_label_graph import label_graph, LabelConfig
@st.cache_data
def weather_data ():
x = pd.date_range(start='2022-01-01', end='2022-12-31', freq='D')
y = np.sin(2 * np.pi * x.dayofyear / 365) + np.random.normal(0, 0.1, size=len(x))
return pd.DataFrame({'date': x, 'temperature': y})
config: LabelConfig = {
'categories': [
{'key': 'HOT', 'color': 'rgba(255 110 110,0.1)'},
{'key': 'COLD', 'color': 'rgba(110,110,255,0.1)'}
]
}
df = weather_data()
figure = px.line(df, x=df['date'], y=df['temperature'])
labels = label_graph(figure, config)
df['label'] = labels['series']
fig = make_subplots(specs=[[{"secondary_y": True}]])
fig.add_trace(go.Line(x=df['date'], y=df['temperature'], name='temperature'), secondary_y=False)
fig.add_trace(go.Line(x=df['date'], y=df['label'], name='label'), secondary_y=True)
st.write(fig)
st.write(labels)
- Use Ctrl + Mouse-drag to create a new label
- Right click on a label to set the category
Run demo
python -m streamlit_label_graph
Release files for streamlit-label-graph 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| streamlit-label-graph-0.1.2.tar.gz | 63.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| streamlit_label_graph-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 128.7 kB
Release files / streamlit-label-graph-0.1.2.tar.gz
| Download URL | streamlit-label-graph-0.1.2.tar.gz |
|---|---|
| Size | 63.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
846cd3f4427af765eecabdd3831882c0d5dc4c5baf40833c99362d06bcebf18f
|
|
BLAKE2b-256 checksum How to use checksums |
8b93b9487ff3604f23440b33fccf9e8a0ce03b9f95dd4304a0e7e9a0a519110c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / streamlit_label_graph-0.1.2-py3-none-any.whl
| Download URL | streamlit_label_graph-0.1.2-py3-none-any.whl |
|---|---|
| Size | 64.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd68ade0421ba0e894353f92b0060d373cd0109388eef61d9af0e76f16f4d756
|
|
BLAKE2b-256 checksum How to use checksums |
ebec85cc35fbdce6b9287699a46ffcd29e4e342cac513e260b4e46961686fb27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|