Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

253
Visualizações
python add matplotlib figure into webpage

I have already read the following Call Python function from JavaScript code

interpol.py

import numpy as np
from math import sqrt
import matplotlib.pyplot as plt

def interpol(x0, x, y):
    x = np.asfarray(x)
    y = np.asfarray(y)
    ....
    return f0

if __name__ == '__main__':

    x = [-5,-4.19,-3.54,-3.31,-2.56,-2.31,-1.66,-0.96,-0.22,0.62,1.21]
    y = [0.01,0.01,0.03,0.04,0.07,0.09,0.16,0.28,0.45,0.65,0.77]
    plt.scatter(x, y)
    x_new = np.linspace(-6, 2)
    plt.plot(x_new, interpol(x_new, x, y)) #output the figure

    plt.show()

This python code output a figure.

I would like get x and y arrays from html input and give them to the python code (In this example I use x and y in the python, but I would like to get those from html input), and output the python figure into the webpage.

I know that I have to use server and I would like to use jQuery.ajax().

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda