Worksheets (6-10) Data Visualisation
Worksheets (6-10) Data Visualisation
67 | P a g e
20. You can set different width for different bars in bar chart. (True/False)
21 If you are given to plot a histogram using numpy array as per the code given below
then answer any of four question from (i) to (v)
(v) To fill in blank on Line 10 for showing histogram what can beeused ?
(a) plt.show() (b) plt_show()
(c) plot_show() (d) plt.show
************
68 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA VISUALISATION (UNIT – 1)
WORKSHEET - 2
69 | P a g e
B. Bar chart
C. Pie chart
D. Scatter plot
9. Which method is used to plot horizontal bar graph in pyplot ?
A. horizontal_bar()
B. barh()
C. hbar()
D. bar()
10. Which method is used to plot histogram in pyplot?
A. his()
B. hist()
C. Hist()
D.histogram()
11. Consider the following program and answer any four question from (i) to
(v):
import _______ as plt #line 1
plt.bar ([2,3,4,8,1],[2,4,7,3,5], label= _____ ) #line 2
plt.legend( ) #line 3
plt.xlabel(____ ) #line 4
plt.ylabel(‘Height’) #line 5
plt._______ (‘Vertical Bar Chart’) #line 6
________________ #line 7
(ii) Name the label that can be used to represent the bar chart in Line 2 .
a) Data (b) Data Values
b) Values for X axix (d) All of these
(iv) Which method will take place at Line 6 for setting heading on the top of Chart ?
(a) Title() (b) title()
(c) Head() (d) All of these.
12. Consider the following case and answer the from (i) to (v)
70 | P a g e
import …………. as pd #line 1
import matplotlib. _____ as plt #line 2
data= {‘Name’ : [‘Karan’, ‘Adi’, ‘Abhinav’, ‘Kirti’, ‘Rahul’ ],
‘Height’ : [60,61,63,65,61],
‘Weight’ : [47,89,52,58,50,47]}
df=pd. _________ (data) #line 6
df._____ (Kind =’hist’, edgecolor = ‘Green’, linewidth =2, linestyle=’:’ , fill= False)
#line 7
_____________ #line 8
13. Mr. Vijay is working in the mobile app development industry and he was
comparing the given chart on the basis of the rating of the various apps available
on the play store and answer the questions (i) to (v).
71 | P a g e
He is trying to write a code to plot the graph. Help Mr. Vijay to fill in the blanks of the
code and get the desired output.
plt.__________(apps,ps_rating,color='m',label=__________) #Statement 2
,Statement 3
plt.xlabel("Apps")
plt._____________("Rating") #Statement 4
plt._________ #Statement 5
plt.________ #Statement 6
************
72 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA VISUALISATION (UNIT – 1)
WORKSHEET - 3
**************
73 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA VISUALISATION (UNIT – 1)
WORKSHEET - 4
2. Collect data about colleges in Delhi University or any other university of your choice
and number of courses they run for Science, Commerce and Humanities, store it in a
CSV file and present it using a bar plot.
3. Collect the minimum and maximum temperature of your city for a month and present
it using a histogram plot.
4. Plot the following data on line chart:
Runs in Overs 10 20
MI 110 224
RCB 85 210
5. Write code to plot a line chart to depict the run rate of T20 match from given data:
Overs Runs
5 45
10 79
15 145
20 234
7. How to change the thickness of line, line style, line color, and marker properties of
a chart?
74 | P a g e
8. Mrs. Sharma is a coordinator in the senior section school. She represented data on
number of students who passed the exam on line chart as follows:
She has written the following code but not getting the desired output. Help her
by correcting her code.
*************
75 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA VISUALISATION (UNIT – 1)
WORKSHEET - 5
1. Consider that a survey has to be done on how much distance the following vehicles have
covered in a span of five days. The data collected can be plotted in different plotting methods.
plot the data using Line plot:
BIKES
DAYS DISTANCE COVERED IN KMS
ENFIELD HONDA YAHAMA KTM
DAY 1 50 80 70 80
DAY 2 40 20 20 20
DAY 3 70 20 60 20
DAY 4 80 50 40 50
DAY 5 20 60 60 60
2. Consider question No.9 and plot the data using Bar Chart.
3. Consider question No.9 and plot the data using Pie Plot.
4. Consider question No.9 and plot the data using Scatter Plot.
5. Consider question No.9 and plot the data using Histogram Plot.
6. Write a Python program to draw line charts from the given financial data of ABC Co.
for 5 days in the form a DataFrame namely fdf as shown below :
Day1 Day2 Day3 Day4 Day5
0 74.25 56.03 59.30 69.00 89.65
1 76.06 68.71 72.07 78.47 79.65
2 69.50 62.89 77.65 65.53 80.75
3 72.55 56.42 66.46 76.85 85.08
7. Write a program to create a horizontal bar chart for India's medal tally.
Australia 80 59 59 198
England 45 45 46 136
India 26 20 20 66
Canada 15 40 27 82
8. Write a python code to draw the following bar graph representing the total sales in
each quarter. Add the title, label for X-axis, Y-axis. Use the following data for
plotting the graph.
76 | P a g e
Sales = [450,300,500,850]
Qtr = [“Qtr1”, “Qtr2”, “Qtr3”,”Qtr4”]
77 | P a g e