Chapter 4
Plotting Data using Matplotlib
1. What is the purpose of the Matplotlib library?
Answer:
2. What are some of the major components of any graphs or plot?
Answer:
3. Name the function which is used to save the plot.
Answer:
4. Write short notes on different customisation options available with any plot.
Answer:
5. What is the purpose of a legend?
Answer:
6. Define Pandas visualisation.
Answer:
7. What is open data? Name any two websites from which we can download open data.
Answer:
8. Give an example of data comparison where we can use the scatter plot.
Answer:
9. Name the plot which displays the statistical summary. Note: Give appropriate title, set xlabel and ylabel while attempting the following questions.
Answer:
10. Plot the following data using a line plot:
• Before displaying the plot display “Monday, Tuesday, Wednesday, Thursday, Friday,
Saturday, Sunday” in place of Day 1, 2, 3, 4, 5, 6, 7
• Change the color of the line to ‘Magenta’.
Answer:
11. 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.
Answer:
12. Collect and store data related to the screen time of students in your class separately for boys and girls and present it using a boxplot.
Answer:
13. Explain the findings of the boxplot of Figure 4.18 by filling the following blanks:
a) The median for the five subjects is _ , , , ,
Answer:
b) The highest value for the five subjects is : , , , ,
Answer:
c) The lowest value for the five subjects is : , , , ,
Answer:
d) _____ subject has two outliers with the value and
Answer:
e) __ subject shows minimum variation
Answer:
14. Collect the minimum and maximum temperature of your city for a month and present it using a histogram plot.
Answer:
15. Conduct a class census by preparing a questionnaire. The questionnaire should contain a minimum of five questions. Questions should relate to students, their family members, their class performance, their health etc. Each student is required to fill up the questionnaire. Compile the information in numerical terms (in terms of percentage). Present the information through a bar, scatter–diagram. (NCERT Geography class IX, Page 60)
Answer:
16. Visit data.gov.in , search for the following in “catalogs” option of the website:
• Final population Totals, India and states
• State Wise literacy rate
Download them and create a CSV file containing population data and literacy rate of the respective state. Also add a column Region to the CSV file that should contain the values East, West, North and South. Plot a scatter plot for each region where X axis should be population and Y axis should be Literacy rate. Change the marker to a diamond and size as the square root of the literacy rate. Group the data on the column region and display a bar chart depicting average literacy rate for each region.
Answer: