mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-20 10:47:35 -05:00
53 lines
1.1 KiB
HTML
53 lines
1.1 KiB
HTML
<html>
|
|
<head>
|
|
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
|
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
|
<style>
|
|
h1 {
|
|
color: #459db9;
|
|
}
|
|
|
|
.pulse {
|
|
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
}
|
|
|
|
@keyframes pulse {
|
|
0%, 100% {
|
|
opacity: 1;
|
|
}
|
|
50% {
|
|
opacity: .2;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<h1>Let's plot random numbers</h1>
|
|
<div id="plot">
|
|
<div class="pulse" >
|
|
<p style='font-family: monospace sans-serif;'><big><big><big><big>❰py❱</big></big></big></big></p>
|
|
</div>
|
|
</div>
|
|
|
|
<py-config>
|
|
packages = [
|
|
"numpy",
|
|
"matplotlib"
|
|
]
|
|
</py-config>
|
|
|
|
<py-script>
|
|
import matplotlib.pyplot as plt
|
|
import numpy as np
|
|
|
|
x = np.random.randn(1000)
|
|
y = np.random.randn(1000)
|
|
|
|
fig, ax = plt.subplots()
|
|
ax.scatter(x, y)
|
|
pyscript.write('plot', fig)
|
|
</py-script>
|
|
</body>
|
|
</html>
|