Data Visualization Python Basics
Data Visualization Python Basics
Week 7
Data Visualization using python
Data visualization in Python is primarily done using Matplotlib and Pandas’ built-in plotting
functionalities. This week covers how to create and customize plots using these libraries.
python
Additionally, in Jupyter Notebook, `%matplotlib notebook` can be used to enable interactive plotting.
python
x = np.arange(10)
y = np.sin(x)
plt.plot(x, y)
plt.show()
Plots are contained within a figure object, which allows multiple subplots to be placed within it.
python
fig = plt.figure()
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 1/3
This creates an empty figure. Subplots can be added using:
python
This will create a 2×2 grid of subplots, where each subplot can have its own graph.
Pandas’ `plot()` function can quickly generate different types of plots from DataFrames.
python
python
df.plot.bar()
plt.show()
5. Customizing Plots
python
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 2/3
python
plt.style.use("ggplot")
6. Conclusion
This module covered essential Matplotlib and Pandas visualization techniques, including basic plots,
figure handling, subplots, and styling.
Sources
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 3/3