Matplotlib: Histograms, Subplots, and 3D Plots
### 1. Creating a Histogram in Matplotlib
A histogram is used to represent the distribution of numerical data. In Matplotlib, you can create a
histogram using the [Link]() function.
#### Example:
```python
import [Link] as plt
import numpy as np
data = [Link](1000) # Generating random data
[Link](data, bins=30, color='blue', edgecolor='black')
[Link]('Value')
[Link]('Frequency')
[Link]('Histogram Example')
[Link]()
```
---
### 2. Purpose of [Link]() in Matplotlib
The [Link]() function in Matplotlib is used to create multiple subplots in a single figure. It
returns a figure and an array of axes, which allows for easy manipulation of multiple plots.
#### Example: Creating Multiple Subplots
```python
fig, axes = [Link](2, 2, figsize=(10, 8)) # 2x2 grid of subplots
axes[0, 0].plot([1, 2, 3], [4, 5, 6])
axes[0, 1].scatter([1, 2, 3], [6, 5, 4])
axes[1, 0].bar(['A', 'B', 'C'], [10, 20, 30])
axes[1, 1].hist([Link](100), bins=20)
[Link]()
```
---
### 3. Creating a 3D Plot in Matplotlib
To create 3D plots, Matplotlib provides the Axes3D module from mpl_toolkits.mplot3d.
#### Example: Creating a 3D Surface Plot
```python
import [Link] as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
fig = [Link]()
ax = fig.add_subplot(111, projection='3d')
X = [Link](-5, 5, 100)
Y = [Link](-5, 5, 100)
X, Y = [Link](X, Y)
Z = [Link]([Link](X**2 + Y**2))
ax.plot_surface(X, Y, Z, cmap='viridis')
[Link]()
```
---
### Conclusion
- Histograms visualize data distribution using [Link]().
- [Link]() simplifies subplot creation and manipulation.
- 3D plots are created using mpl_toolkits.mplot3d for advanced visualizations.
---
**End of Assignment**