Plotting Data using Matplotlib

Chapter 4

1. What is the purpose of the Matplotlib library?

2. What are some of the major components of any graphs or plot?

3. Name the function which is used to save the plot.

4. Write short notes on different customisation options available with any plot.

5. What is the purpose of a legend?

6. Define Pandas visualisation.

7. What is open data? Name any two websites from which we can download open data.

8. Give an example of data comparison where we can use the scatter plot.

9. Name the plot which displays the statistical summary.

Note: Give appropriate title, set xlabel and ylabel while attempting the following questions.

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’.

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.

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.

13. Explain the findings of the boxplot of Figure 4.18 by filling the following blanks:

a) The median for the five subjects is _____ , ______, _______, ______, ______

b) The highest value for the five subjects is : _____ , ______, _______, ______, ______

c) The lowest value for the five subjects is : _____ , ______, _______, ______, ______

d) ______________ subject has two outliers with the value ________ and ________

e) ______________ subject shows minimum variation

14. Collect the minimum and maximum temperature of your city for a month and present it using a histogram plot.

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)

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.


Questions Type By: Himashree Bora.


DABP007100