Spaces:
Running
Running
Download image/overlay/home/user/examples/plot.py from ereniko/LocalWebAgent: direct link, hf CLI and curl.
- Browser
- Download file 478 Bytes
-
https://huggingface.co/spaces/ereniko/LocalWebAgent/resolve/main/image/overlay/home/user/examples/plot.py
- Command line
-
hf download hf://spaces/ereniko/LocalWebAgent/image/overlay/home/user/examples/plot.py
-
curl -L -o plot.py https://huggingface.co/spaces/ereniko/LocalWebAgent/resolve/main/image/overlay/home/user/examples/plot.py
478 Bytes
| # Draws a chart with matplotlib and saves it as plot.png (open it in the Files view). | |
| import math | |
| import matplotlib.pyplot as plt | |
| xs = [i / 10 for i in range(0, 101)] | |
| fig, ax = plt.subplots(figsize=(7, 4), dpi=110) | |
| ax.plot(xs, [math.sin(x) for x in xs], label="sin(x)") | |
| ax.plot(xs, [math.cos(x) * 0.6 for x in xs], label="0.6 cos(x)") | |
| ax.set_title("Plotted inside your browser") | |
| ax.grid(alpha=0.3) | |
| ax.legend() | |
| fig.tight_layout() | |
| fig.savefig("plot.png") | |
| print("Wrote plot.png") | |