The document provides code examples for creating various types of plots using Matplotlib, including line plots, scatter plots, bar plots, histograms, box plots, pie charts, heatmaps, and 3D plots. Each section includes the necessary code to generate the respective plot along with titles and axis labels. The examples demonstrate the versatility of Matplotlib for visualizing data in different formats.
The document provides code examples for creating various types of plots using Matplotlib, including line plots, scatter plots, bar plots, histograms, box plots, pie charts, heatmaps, and 3D plots. Each section includes the necessary code to generate the respective plot along with titles and axis labels. The examples demonstrate the versatility of Matplotlib for visualizing data in different formats.
import numpy as np data = np.random.randn(1000) plt.hist(data, bins=30) plt.title('Histogram') plt.xlabel('Value') plt.ylabel('Frequency') plt.show() Box Plot Code:
import matplotlib.pyplot as plt
import numpy as np data = [np.random.randn(100) for _ in range(5)] plt.boxplot(data) plt.title('Box Plot') plt.xlabel('Dataset') plt.ylabel('Value') plt.show() Pie Chart Code: