2303A54054 - Lab Assignment 1 - Colab
2303A54054 - Lab Assignment 1 - Colab
Lab Assignment - 1
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.
fig, ax = plt.subplots()
ax.bar(x, y, color=['skyblue', 'orange', 'green', 'red'])
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])
plt.show()
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)
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]