pip install matplotlib numpy
python - <<'EOF'
import matplotlib
print('matplotlib version:', matplotlib.__version__)
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2 * np.pi, 200)
plt.figure(figsize=(8, 4))
plt.plot(x, np.sin(x), label='sin')
plt.plot(x, np.cos(x), label='cos')
plt.legend()
plt.title('Matplotlib Demo')
plt.tight_layout()
plt.savefig('/tmp/demo.png', dpi=120)
print('Saved to /tmp/demo.png')
EOF
