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

3 - Homework - Data Visualizations Programs

The document contains practical exercises for using Matplotlib in Python for data visualization. It includes three programs: creating a histogram of student marks, formatting charts with labels and legends for sales comparison, and analyzing temperature data using a line chart. Each program is accompanied by code snippets and aims to demonstrate different visualization techniques.
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)
4 views2 pages

3 - Homework - Data Visualizations Programs

The document contains practical exercises for using Matplotlib in Python for data visualization. It includes three programs: creating a histogram of student marks, formatting charts with labels and legends for sales comparison, and analyzing temperature data using a line chart. Each program is accompanied by code snippets and aims to demonstrate different visualization techniques.
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

Python Practical File - Matplotlib Programs

Name: ____________________

Class: ____________________

Subject: Data Visualization / Python

Program 3: Create a Histogram


Aim: To create a histogram using Matplotlib.

Code:

import [Link] as plt

marks = [45, 56, 67, 78, 89, 90, 72, 65, 54, 48, 92, 85, 73, 60, 58]

[Link](marks, bins=5)

[Link]("Marks Range")
[Link]("Number of Students")
[Link]("Histogram of Student Marks")

[Link]()

Program 4: Format Charts with Labels and Legends


Aim: To format charts using labels and legends.

Code:

import [Link] as plt

months = ["Jan", "Feb", "Mar", "Apr", "May"]


sales_2024 = [2000, 2500, 3000, 2800, 3500]
sales_2025 = [2200, 2700, 3200, 3000, 3800]

[Link](months, sales_2024, label="Sales 2024")


[Link](months, sales_2025, label="Sales 2025")

[Link]("Months")
[Link]("Sales Amount")
[Link]("Yearly Sales Comparison")

[Link]()

[Link]()

Program 5: Analyze Data Using Line Chart


Aim: To analyze data using a line chart.

Code:

import [Link] as plt

days = [1, 2, 3, 4, 5, 6, 7]
temperature = [28, 30, 32, 31, 29, 27, 26]

[Link](days, temperature)

[Link]("Days")
[Link]("Temperature (°C)")
[Link]("Weekly Temperature Analysis")

[Link]()

Teacher's Signature: ____________________

Date: ____________________

You might also like