0% found this document useful (0 votes)
5 views

Detailed_Python_Exam_Notes

The document provides detailed notes on Python data visualization, focusing on libraries like Matplotlib and Seaborn. It covers various plotting techniques, including line plots, bar charts, box plots, violin plots, and heatmaps, along with examples of code for each. Additionally, it highlights the differences between Matplotlib and Seaborn in terms of functionality and ease of use.

Uploaded by

mnimal2006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Detailed_Python_Exam_Notes

The document provides detailed notes on Python data visualization, focusing on libraries like Matplotlib and Seaborn. It covers various plotting techniques, including line plots, bar charts, box plots, violin plots, and heatmaps, along with examples of code for each. Additionally, it highlights the differences between Matplotlib and Seaborn in terms of functionality and ease of use.

Uploaded by

mnimal2006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Detailed Python Exam Notes

1. Data Visualization
Data Visualization is the graphical representation of data to help understand trends, patterns, and
outliers. Python offers several libraries such as matplotlib, seaborn, and plotly to visualize data.

Example:
import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [4, 5, 6])
plt.title('Line Plot')
plt.show()

2. Matplotlib Plotting
Matplotlib is a powerful library for creating static, animated, and interactive visualizations. It supports
many plot types:
- Line
- Bar
- Histogram
- Scatter

Example:
plt.bar(['A', 'B', 'C'], [5, 7, 3])
plt.xlabel('Category')
plt.ylabel('Values')
plt.title('Bar Chart')
plt.show()

3. Seaborn Plot (Box Plot, Violin Plot, Heatmap)


Seaborn is built on top of matplotlib and simplifies the creation of beautiful plots.

Box Plot: sns.boxplot(x='day', y='total_bill', data=tips)


Violin Plot: sns.violinplot(x='day', y='total_bill', data=tips)
Heatmap: sns.heatmap(data.corr(), annot=True)
Detailed Python Exam Notes

4. Seaborn vs Matplotlib
Matplotlib provides low-level functions for custom plots, while Seaborn is high-level and produces
attractive visuals easily.

Seaborn handles dataframes well, has themes, and complex plots like violin and heatmaps with
simple commands.

5. Histogram in Matplotlib
A histogram shows the distribution of numeric data. It divides data into bins and counts occurrences.

Example:
plt.hist([10, 20, 20, 30], bins=3, edgecolor='black')
plt.title('Histogram')
plt.show()

You might also like