0% found this document useful (0 votes)
19 views6 pages

2303A54054 - Lab Assignment 1 - Colab

Uploaded by

2303A54054
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)
19 views6 pages

2303A54054 - Lab Assignment 1 - Colab

Uploaded by

2303A54054
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/ 6

Course Name : Data Visualization and Business Intelligence

Date : 17 Aug 2024

Lab Assignment - 1

Name : Aelishala Manoj

Registation no : 2303A54054

Batch no : 47

Q1) Create a bar chart .You have been given performance scores for four different teams: A, B, C, and D. The scores are stored in two arrays, x
for team names and y for their respective scores. Use Matplotlib to create a bar chart that visualizes the performance of each team. Ensure that
the chart is well-labeled, with the team names on the x-axis and their scores on the y-axis. Add a title and consider using different colors for the
bars to enhance clarity.

x = np.array(["A", "B", "C", "D"])


y = np.array([3, 8, 1, 10])

import matplotlib.pyplot as plt


import numpy as np

x = np.array(["A", "B", "C", "D"])


y = np.array([3, 8, 1, 10])

fig, ax = plt.subplots()
ax.bar(x, y, color=['skyblue', 'orange', 'green', 'red'])

ax.set_title('Team performance Scores')


ax.set_xlabel('Team')
ax.set_ylabel('Score')

plt.show()
 

Q2) Create a pie chart. You are analyzing the market share of four different companies in a specific industry. The market share percentages are
stored in the array y. Use Matplotlib to create a pie chart that represents the market share distribution among these companies. Ensure that
each slice is labeled with the corresponding percentage, and add a legend or labels to identify each company. Consider adding a title to clearly
convey the purpose of the chart. y = np.array([35, 25, 25, 15])

import matplotlib.pyplot as plt


import numpy as np

y = np.array([35, 25, 25, 15])


labels = ['Company A', 'Company B', 'Company C', 'Company D']

plt.pie(y, labels=labels, autopct='%1.1f%%', startangle=90)


plt.title('Market Share Distribution among Companies')

plt.show()
 

Q3) Create a Scatter chart for the following

x = np.array([5,7,8,7,2,17,2,9,4,11,12,9,6])

y = np.array([99,86,87,88,111,86,103,87,94,78,77,85,86])

Scenario: You are studying the temperature variations over a week in a particular city. You have recorded the temperature for each day and want
to visualize this data. Use Matplotlib to create a line chart with days on the x-axis and temperature on the y-axis. Label the x-axis as "Day" and
the y-axis as "Temperature." Add a title "Weather Trends" to the chart to summarize the data you're presenting. x=[1,2,3,4,5,6,7]

y=[50,51,52,48,47,49,46]
import matplotlib.pyplot as plt
import numpy as np

x = np.array([5,7,8,7,2,17,2,9,4,11,12,9,6])
y = np.array([99,86,87,88,111,86,103,87,94,78,77,85,86])
fig, ax = plt.subplots()
ax.scatter(x, y)

ax.set_title('Scatter Chart of x and y')


ax.set_xlabel('x')
ax.set_ylabel('y')

plt.show()

 

Q4)You are studying the temperature variations over a week in a particular city. You have recorded the temperature for each day and want to
visualize this data. Use Matplotlib to create a line chart with days on the x-axis and temperature on the y-axis. Label the x-axis as "Day" and the
y-axis as "Temperature." Add a title "Weather Trends" to the chart to summarize the data you're presenting.
x=[1,2,3,4,5,6,7]

y=[50,51,52,48,47,49,46]

import matplotlib.pyplot as plt


x = [1, 2, 3, 4, 5, 6, 7]
y = [50, 51, 52, 48, 47, 49, 46]
plt.figure(figsize=(10, 6))
plt.plot(x, y, marker='o', color='blue', linestyle='-', linewidth=2, markersize=6)
plt.xlabel("Day")
plt.ylabel("Temperature")
plt.title("Weather Trends")
plt.show()

You might also like