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

Assignment (Working With Pyplot)

Uploaded by

Aditya Akhouri
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)
26 views2 pages

Assignment (Working With Pyplot)

Uploaded by

Aditya Akhouri
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
You are on page 1/ 2

Working with Pyplot

Q1) Write a python code to plot a line graph based on the following Dataframe’s data:

import pandas as pd

import matplotlib.pyplot as plt

df = pd.DataFrame({‘Name’:[‘Punit’,’Sumit’, ‘Sohan’, ‘Pawan’, ‘Vinay’, ‘Tanmay’],

‘Age’:[22,18,28,20,39,25], ‘Weight’:[42,55,50,65,60,55]})

The line graph’s xaxis and yaxis value may be taken as dataframe’s index value and

dataframe’s Age value respectively.

The code also includes the following:

i)Title

ii) Value for x label and y label

iii) Two different colours for the lines

iv) save the figure with any name.

Q2) Consider the following graph. Write the python code to plot the graph .
Q3) Write the output from the following given code:( assume that library has been

already imported as plt .

Months=[‘Jan’, ‘Feb’, ‘March’, ‘April’]


Attendance=[70,90,75,85]
plt.bar(Months, Attendance, width=[0.3,0.7,0.5,0.6]
plt.xlabel(“Months name”)
plt.ylabel(“Attendance percentage”)
plt.show()
Q4) In a term examination, the marks obtained in Informatics Practices by 20 students are
given below:
Markis=[ 62,78,89,86,87,90,95,93,96,86,67,65,83,82,72,75,76,78,64,92]
Write a code in python to plot a histogram from the above data.
The code also includes the following:
i) bins=[60,70,80,90,100]
ii) bar colour set to magenta and edge colour set to black
iii) x-label and ylabel
iv) Title

You might also like