파이썬/노하우

파이썬 결과를 웹페이지에 로딩

모두의 실험실 2023. 10. 9. 16:13
728x90

 

 

파이썬 코드 결과를 페이지에 로딩가능하다

결과는 랜덤한 숫자x,y 30개를 출력하고 그래프로 표현한 것이다

{ "packages": ["numpy", "matplotlib"], "plugins" : [ "https://pyscript.net/latest/plugins/python/py_tutor.py" ] }

랜덤 숫자 출력과 그래프그리기

import matplotlib.pyplot as plt import numpy as np x = np.random.randn(30) y = np.random.randn(30) print('x values : ',x) print('y values : ',y) fig, ax = plt.subplots() ax.scatter(x, y) display(fig)
728x90
반응형