0% found this document useful (0 votes)
2 views2 pages

Ex 2 Data Visualization Matplotlib Seaborn

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

Ex 2 Data Visualization Matplotlib Seaborn

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

EX.

NO : Data Visualization with Matplotlib and Seaborn


Problem
A data analyst wants to visually represent data in graphical form to better
understand patterns, trends, and relationships within the dataset. Visualization
techniques help in summarizing large amounts of information and support
effective decision-making. Using Python libraries such as Matplotlib and
Seaborn, charts such as line graphs, bar charts, histograms, scatter plots, and
heatmaps can be created for analysis.

Aim
To create and analyze different visual representations of data using Matplotlib
and Seaborn libraries in Python.

Procedure
Step 1: Import the necessary libraries such as pandas, matplotlib, and seaborn.

Step 2: Load the dataset into Python.

Step 3: Display the first few records of the dataset.

Step 4: Create a line plot to visualize trends in data.

Step 5: Create a bar chart to compare categorical values.

Step 6: Generate a histogram to observe data distribution.

Step 7: Create a scatter plot to identify relationships between variables.

Step 8: Generate a heatmap to visualize correlations among variables.

Step 9: Display all plots using the show() function.

Step 10: Interpret the graphical results obtained from the visualization.

Python Coding
# Import necessary libraries
import pandas as pd
import [Link] as plt
import seaborn as sns
# Load dataset
data = pd.read_csv("[Link]")

# Display first five records


print([Link]())

# Line Plot
[Link]()
[Link]([Link][:,0], [Link][:,1])
[Link]("Line Plot")
[Link]()

# Bar Chart
[Link]()
[Link][:,1].value_counts().plot(kind='bar')
[Link]("Bar Chart")
[Link]()

# Histogram
[Link]()
[Link]([Link][:,1])
[Link]("Histogram")
[Link]()

# Scatter Plot
[Link]()
[Link]([Link][:,0], [Link][:,1])
[Link]("Scatter Plot")
[Link]()

# Heatmap
[Link]()
[Link]([Link](), annot=True)
[Link]("Heatmap")
[Link]()

Result
Thus, different graphical representations were successfully created using
Matplotlib and Seaborn to visualize and analyze the dataset.

You might also like