Core9X
Log inSign up

MBOSE Class XII Informatics Practices · Chapter 4

Plotting Data Using Matplotlib

Opening soon

Learn to turn data into clear line graphs, bar charts, histograms, pie charts and more using Matplotlib in Python.

14 lessons · 56 practice questions · unit "Data Handling using Pandas and Data Visualisation" carries 25 marks

See classes open nowLog inMBOSE Class XII opens to new students soon.

What this chapter covers

  • Data visualisation
  • Matplotlib and Pyplot
  • Plot(), bar(), barh(), hist(), scatter(), boxplot(), pie()
  • Title, labels, ticks, legend, grid, savefig(), show()
  • Customisation — marker, markersize, colour, linewidth, linestyle
  • Pandas plot() function
  • Box plots and quartiles

Key terms

Data visualisation

Graphical representation of data

Pyplot

Matplotlib module of plotting functions

Marker

Symbol drawn at each data point

Legend

Key naming each plotted series

Histogram

Bars showing frequencies of value ranges

Bin

One interval of a histogram

Box plot

Chart of minimum, quartiles, median, maximum

Outlier

Value far from the rest of the data

savefig()

Saves a chart to a file

Important questions with answers

10 of the 56 questions on this chapter, solved.

  1. Question 1 · Multiple choice · 1 mark

    Data visualisation is

    • (a) the graphical representation of data
    • (b) deleting data
    • (c) a database
    • (d) a CSV file

    Answer: (a) the graphical representation of data

    Charts, graphs and maps.

  2. Question 2 · Multiple choice · 1 mark

    The chart showing a frequency distribution is the

    • (a) line chart
    • (b) pie chart
    • (c) scatter plot
    • (d) histogram

    Answer: (d) histogram

    Bars for value ranges.

  3. Question 3 · Multiple choice · 1 mark

    Each series is named in a key with

    • (a) legend()
    • (b) title()
    • (c) xlabel()
    • (d) grid()

    Answer: (a) legend()

    With label= in each plot call.

  4. Question 4 · Multiple choice · 1 mark

    The bars of a histogram

    • (a) touch each other
    • (b) have gaps between them
    • (c) are always horizontal
    • (d) show categories

    Answer: (a) touch each other

    The intervals are continuous.

  5. Question 5 · Assertion and reason · 1 mark

    Assertion (A): A line chart suits data that changes over time.

    Reason (R): It joins the data points in order.

    • (a) Both A and R are true, and R is the correct explanation of A.
    • (b) Both A and R are true, but R is not the correct explanation of A.
    • (c) A is true, but R is false.
    • (d) A is false, but R is true.

    Answer: (a) Both A and R are true, and R is the correct explanation of A.

    The trend is visible.

  6. Question 6 · Short answer · 2 marks

    Name four chart types of Pyplot with their functions.

    Answer

    Line plot(), bar bar(), histogram hist(), pie pie().

  7. Question 7 · Short answer · 2 marks

    What does bins=5 do in hist()?

    Answer

    Divides the data range into five intervals.

  8. Question 8 · Short answer · 3 marks

    How do you plot two series with a legend?

    Answer

    Give each plot() a label, then call plt.legend().

  9. Question 9 · Long answer · 5 marks

    Explain data visualisation and the Pyplot chart functions.

    Answer

    Sections 1.1–1.2; Section 8.2 (HSSLC 2024, Q3(e)).

  10. Question 10 · Long answer · 5 marks

    Write a program for a horizontal bar chart of a medal tally and save it.

    Answer

    Section 1.2; Section 8.2 (HSSLC 2026, Q33(a)).

Study the whole chapter

14 step-by-step lessons, all 56 practice questions with hints, flashcards and mock tests for MBOSE Class XII Informatics Practices.

See classes open nowLog inMBOSE Class XII opens to new students soon.