item.png, item.data) are SDK-only. Via the CLI or HTTP
API, save the figure to a file (as above) and fetch it with code artifact download or a filesystem read.
Download a saved chart from the machine:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Generate PNG and file-based chart outputs with Python plotting libraries.
result = machine.run_code("""
import matplotlib.pyplot as plt
plt.figure(figsize=(4, 3))
plt.bar(["A", "B", "C"], [3, 7, 5])
plt.title("Example chart")
plt.tight_layout()
plt.savefig("/workspace/chart.png")
plt.show()
""")
png_outputs = [
item for item in result.results
if item.png or (item.data and "image/png" in item.data)
]
print(len(png_outputs))
item.png, item.data) are SDK-only. Via the CLI or HTTP
API, save the figure to a file (as above) and fetch it with code artifact download or a filesystem read.
Download a saved chart from the machine:
chart_bytes = machine.files.read("/workspace/chart.png", format="bytes")