#!/usr/bin/env python3
# usage: uv run hello-matplotlib.py
# 
# requirements: matplotlib
import math
import matplotlib.pyplot as plt

# setup two figures side by side
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))

# sine wave 
lstx = [x * 2 * math.pi / 100 for x in range(100)]
lsty = [math.sin(x) for x in lstx]
ax1.plot(lstx, lsty)
ax1.set_title('Sine Wave')
ax1.set_xlabel('x')
ax1.set_ylabel('sin(x)')

# bar chart
fruits = ['apple', 'blueberry', 'cherry', 'orange']
counts = [40, 100, 30, 55]
ax2.bar(fruits, counts)
ax2.set_title('Fruit Counts')
ax2.set_xlabel('Fruit')
ax2.set_ylabel('Count')

fig.savefig('hello.png', dpi=200)
plt.show()
