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

DataVisualization Revision

Uploaded by

shreyanshi1718
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)
40 views2 pages

DataVisualization Revision

Uploaded by

shreyanshi1718
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

DATA VISUALIZATION REVISION

1. Consider the following graph. Write the code to plot it. Also label the X and Y axis.

import matplotlib.pyplot as plt


X=[1, 2, 3, 4, 5]
Y=[12, 14, 13, 15, 19]
plt.plot(X,Y)
plt.xlabel('Tests')
plt.ylabel('Marks secured')
plt.show()

2. Write code to draw the following bar graph representing the total number of medals
won by Australia.

import matplotlib.pyplot as plt


X=['Gold', 'Silver', 'Bronze', 'Total']
Y=[75, 50, 50, 200]
plt.bar(X,Y)
plt.xlabel('Medals won by Australia')
plt.ylabel('Medals won')
plt.title('AUSTRALIA MEDAL PLOT')
plt.show()
3. Consider the following graph. Write the Python code to plot it. Also add the Title and
Label for X and Y axis.

import matplotlib.pyplot as plt


cl = [7,8,9,10,11,12]
avmarks=[83,75,81,72,88,86]
plt.plot(cl,avmarks)
plt.title("AVERAGE RESULT OF CLASS VII-XII")
plt.xlabel('CLASS')
plt.ylabel('AVERAGE MARKS SCORED')
plt.show()

4. Write a Python code to draw the following bar graph representing the average marks secured by
each student in Term - 2 Exam. Add the Title and Label forX-axis and Y-axis. Use the following
data to draw the graph:

import matplotlib.pyplot as plt


names = ['ruby', 'yugesh', 'Vishesh', 'Rakesh']
averagemarks=[84,92,45,72]
plt.bar(names, averagemarks)
plt.title("RESULT OF TERM-2 EXAM")
plt.xlabel('STUDENT NAMES')
plt.ylabel('AVERAGE MARKS SCORED')
plt.show()

You might also like