Plotly graph for labelling timeserie data
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for streamlit-label-graph-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 846cd3f4427af765eecabdd3831882c0d5dc4c5baf40833c99362d06bcebf18f |
|
MD5 | bd89fc01dfcbce89008a0d2d8d8cd967 |
|
BLAKE2b-256 | 8b93b9487ff3604f23440b33fccf9e8a0ce03b9f95dd4304a0e7e9a0a519110c |
Close
Hashes for streamlit_label_graph-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd68ade0421ba0e894353f92b0060d373cd0109388eef61d9af0e76f16f4d756 |
|
MD5 | 87d1e4364ef905c9f78e54cf83211790 |
|
BLAKE2b-256 | ebec85cc35fbdce6b9287699a46ffcd29e4e342cac513e260b4e46961686fb27 |