# Simple drawing

## Sine wave

```python
import numpy as np
import matplotlib.pyplot as plt

x = np.arange(0, 360)
y = np.sin(np.radians(x))

plt.plot(x, y)
plt.show()
```

![](https://678042047-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Le4Kw7aXTv8Say69hfT%2F-MInkpwh41yir7qUXI_O%2F-MIo-vck8CZLezv1uf0P%2Fsine%20wave.png?alt=media\&token=ae0255a9-6bb0-42f0-93c9-581404f393d2)

## Subplot

```python
import numpy as np
import matplotlib.pyplot as plt

fig, figure_parts = plt.subplots(3, 2)
fig.suptitle('yingshaoxo: This is life')

degree = 0

for index in range(3 * 2):
    random_num = np.random.randint(180, 360, size=1)[0]
    
    x = np.arange(degree, degree + random_num) 
    y = np.sin(np.radians(x))
    degree += random_num
    
    ax = figure_parts[index//2][index%2]
    ax.set_xlabel(str(index))
    ax.plot(x, y)
    
fig.set_size_inches(19, 12)
plt.savefig('this is life.png', dpi=100, bbox_inches='tight' )
plt.show()
```

![](https://678042047-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Le4Kw7aXTv8Say69hfT%2F-MInkpwh41yir7qUXI_O%2F-MIo2uydHwQJX1fN2GB7%2Fsubplot%2C%20this%20is%20life.png?alt=media\&token=2664e68d-3ea8-427d-ba9c-8b48565f3624)
