Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

447
Vistas
Streamlit: plot mathematical function dynamically with parameters

I am looking for a solution to plot dynamically mathematical function in 2D on a web page made with Streamlit. For example I would like to plot a normal distribution and have two sliders to set the mean and st dev of the distribution. I am looking for something that would continuously update. There are plenty of solution to plot static graphic function. Do you have any clue of which lib I should use ? I did not found example for this topic on internet. Nor specific solution. Would it be possible with plotta.js ? But I am sure some did have the same need as me. Would plottly.js work for this ? (I do not want the backend to compute the functions). If anyone as a code pen, that would be perfect.

Cheers

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Sample code using matplotlib.

import numpy as np
import matplotlib.pyplot as plt
import streamlit as st
 
x = np.linspace(-10,10,100)
 
def normal_dist(x , mean , sd):
    prob_density = np.exp(-0.5*((x-mean)/sd)**2) / np.sqrt(np.pi * sd**2)
    return prob_density
 
mean = st.slider(label='input mean', min_value=0., max_value=100., value=4.)
sd = st.slider(label='input std dev', min_value=0.1, max_value=100., value=4.)
 
pdf = normal_dist(x,mean,sd)

fig, ax = plt.subplots()
plt.plot(x, pdf , color = 'blue')
plt.xlabel('Data points')
plt.ylabel('Probability Density')
st.pyplot(fig)

enter image description here

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda