Feel smooth line_chart doesn’t come with shape control, any alternative solution?
expect
You control the shape.
import numpy as np
import scipy
import streamlit as st
N = 10
rng = np.random.default_rng()
data = {"x": range(N), "y": rng.random(N)}
interpolated = {"x": np.linspace(1, N-1, 100)}
interpolated["linear"] = np.interp(interpolated["x"], data["x"], data["y"])
interpolated["spline"] = scipy.interpolate.CubicSpline(data["x"], data["y"])(
interpolated["x"]
)
interpolated["akima"] = scipy.interpolate.Akima1DInterpolator(data["x"], data["y"])(
interpolated["x"]
)
interpolated["pchip"] = scipy.interpolate.PchipInterpolator(data["x"], data["y"])(
interpolated["x"]
)
st.line_chart(interpolated, x="x")
There are some options in this article.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.