Created
May 2, 2022 19:55
-
-
Save mateusmb/e3500b99f268c9baeec710240782e1f5 to your computer and use it in GitHub Desktop.
Pyscript test with matplotlib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" /> | |
<script defer src="https://pyscript.net/alpha/pyscript.js"></script> | |
<py-env> | |
- numpy | |
- matplotlib | |
</py-env> | |
</head> | |
<body> | |
<h1>Pyscript + Matplotlib</h1> | |
<div id="plot"></div> | |
<py-script output="plot"> | |
import matplotlib.pyplot as plt | |
from mpl_toolkits import mplot3d | |
import numpy as np | |
np.random.seed(3) | |
x = np.random.random(100) | |
y = np.random.random(100) | |
z = np.random.random(100) | |
fig = plt.figure(figsize=(9,6)) | |
ax = plt.axes(projection='3d') | |
ax = ax.scatter3D(x, y, z, color='purple') | |
fig | |
</py-script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment