Last active
September 19, 2021 20:16
-
-
Save trashhalo/bf0b5d54245748f48b6a2e58c1498a41 to your computer and use it in GitHub Desktop.
Python plotting demo in astro
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
#!/usr/bin/env python | |
import sys | |
import matplotlib.pyplot as plt | |
import numpy as np | |
# Data for plotting | |
t = np.arange(0.0, 2.0, 0.01) | |
s = 1 + np.sin(2 * np.pi * t) | |
fig, ax = plt.subplots() | |
ax.plot(t, s) | |
ax.set(xlabel='time (s)', ylabel='voltage (mV)', | |
title='About as simple as it gets, folks') | |
ax.grid() | |
image_format = 'svg' | |
fig.savefig(sys.stdout, format=image_format, dpi=1200) |
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
--- | |
import { Command } from "astro-command"; | |
--- | |
<h1> Python plot demo </h1> | |
<Command caller={import.meta.url} command="./Component.py" sendProps={false} /> |
Author
trashhalo
commented
Sep 19, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment