Skip to content

Instantly share code, notes, and snippets.

@erykml
Created May 1, 2022 19:02
Show Gist options
  • Select an option

  • Save erykml/bc20f3dee89d147658a60651e5229e40 to your computer and use it in GitHub Desktop.

Select an option

Save erykml/bc20f3dee89d147658a60651e5229e40 to your computer and use it in GitHub Desktop.
<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>Plotting a histogram of Standard Normal distribution</h1>
<div id="plot"></div>
<py-script output="plot">
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
rv = np.random.standard_normal(1000)
fig, ax = plt.subplots()
ax.hist(rv, bins=30)
fig
</py-script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment