Skip to content
← Informatics Practices

Informatics Practices · 2nd Puc Optional

Ch 4Plotting Data using Matplotlib — 2nd PUC Informatics Practices, concept-first.

We have already seen how to organise and analyse data using Pandas and NumPy. But analysis alone is not always enough. When you look at a table of numbers, patterns can be hard to spot. That is where visualisation comes in.

44

Q&A

16

Concepts

Not available

Exam weightage

Start learning — read this chapter →

Key concepts

Hover a concept to preview it and jump to its most relevant Q&A.

Chapter contents

The NCERT structure, section by section. Open a section to see its questions, then read the concept-first solution.

4.1

Introduction

We have already seen how to organise and analyse data using Pandas and NumPy. But analysis alone is not always enough. When you look at a table of numbers, patterns can be hard to spot.

4.2

Plotting using Matplotlib

Matplotlib is a Python library used to create static, animated, and interactive 2D plots or figures. It is the standard tool for data visualisation in Python.

4.3

Customisation of Plots

2 Q

Pyplot provides a wide range of functions to make charts more informative and readable. A basic plot shows data, but customisation — adding labels, a title, grid lines, or a legend — turns a raw graph…

4.3.1

Marker

A marker is a symbol that represents a single data value on a chart. In a line plot, by default, only the line connecting the points is drawn.

4.3.2

Colour

The colour of a plotted line or marker is one of the simplest ways to make a chart more readable or to distinguish between multiple data series.

4.3.3

Linewidth and Line Style

The linewidth and linestyle properties let you control the thickness and visual pattern of a line in a Matplotlib chart.

4.4

The Pandas Plot Function (Pandas Visualisation)

The plot() method built into Pandas Series and DataFrame objects is a convenient shortcut. Before Pandas version 0.17.0, you had to import matplotlib.pyplot and call plt.plot() directly.

4.4.1

Plotting a Line chart

2 Q

A line chart (or line plot) is a graph that shows the frequency of data along a number line. It is used to display a continuous dataset — meaning data that flows without gaps, like measurements over t…

Customising Line Plot

The real book's own 'Customising Line Plot' content is Program 4-5 above — the same MelaSales.csv chart styled with marker='', markersize=10, linewidth=3, linestyle='--', and plt.xticks(ticks, df.Day)…

4.4.2

Plotting Bar Chart

Bar charts are the go-to choice when you want to compare values across different categories. A line plot is great for showing trends over time, but it struggles to make clear comparisons between separ…

Customising Bar Chart

The real book's own 'Customising Bar Chart' content is Program 4-7 above — the same MelaSales.csv grouped bar chart styled with color=['red','yellow','purple'], edgecolor='Green', linewidth=2, linesty…

4.4.3

Plotting Histogram

2 Q

A histogram is a type of column chart where each column represents a range of values, not a single value. The height of each column shows how many data points fall into that particular range.

Customising Histogram

The real book's own 'Customising Histogram' content is Program 4-9 above — the same Name/Height/Weight DataFrame styled with edgecolor='Green', linewidth=2, linestyle=':', fill=False, hatch='o'.

Using Open Data

2 Q

The real book's own 'Using Open Data' content is Program 4-10 above — the data.gov.in 'Seasonal and Annual Min/Max Temperature Series — India (1901-2017)' dataset (MinMaxSeasonalIMD2017.csv), read wit…

4.4.4

Plotting Scatter Chart

2 Q

A scatter chart is a two-dimensional method for visualising data. It uses dots to represent the values obtained for two different variables — one variable is plotted along the x-axis and the other alo…

Customising Scatter chart

2 Q

The real book's own 'Customising Scatter chart' content is Program 4-13 (discount vs. sales), sizing bubbles with size=discount10 and styling with color='red', marker='', edgecolor='blue', linewidth=3…

4.4.5

Plotting Quartiles and Box plot

5 Q

When you have a large dataset — like the scores of thousands of students in a national exam — it's hard to see patterns just by looking at raw numbers.

Customising Box plot

The real book's own 'Customising Box plot' content is Program 4-15 above — df.plot(kind='box', title='Compare Resorts', color='red', vert=False).

4.4.6

Plotting Pie Chart

3 Q

A pie chart is a circular graph divided into sectors, where each sector represents a proportion of the total.

Customisation of pie chart

A pie chart shows proportions, but the default look is often too plain. The textbook shows you how to customise it by adding a shadow, exploding a slice, and rotating the chart for better readability.…

Summary

- A plot is a graphical representation of a data set, also known as a graph or chart, used to show the relationship between two or more variables.

Exercises

+Show 16 questions16 questions
  1. Q1What is the purpose of the Matplotlib library?Free
  2. Q2What are some of the major components of any graphs or plot?Free
  3. Q3Name the function which is used to save the plot.Free
  4. Q4Write short notes on different customisation options available with any plot.Preview
  5. Q5What is the purpose of a legend?Preview
  6. Q6Define Pandas visualisation.Preview
  7. Q7What is open data? Name any two websites from which we can download open data.Preview
  8. Q8Give an example of data comparison where we can use the scatter plot.Preview
  9. Q9Name the plot which displays the statistical summary.Preview
  10. Q10Note: Give appropriate title, set xlabel and ylabel while attempting the following questions. Plot the following data using a line plot: | D…Preview
  11. Q11Collect data about colleges in Delhi University or any other university of your choice and number of courses they run for Science, Commerce…Preview
  12. Q12Collect and store data related to the screen time of students in your class separately for boys and girls and present it using a boxplot.Preview
  13. Q13Explain the findings of the boxplot of Figure 4.18 by filling the following blanks: (a) The median for the five subjects is _____ , ______,…Preview
  14. Q14Collect the minimum and maximum temperature of your city for a month and present it using a histogram plot.Preview
  15. Q15Conduct a class census by preparing a questionnaire. The questionnaire should contain a minimum of five questions. Questions should relate t…Preview
  16. Q16Visit data.gov.in , search for the following in “catalogs” option of the website: • Final population Totals, India and states • State Wise l…Preview

Sample & Board Papers

Sample papers and previous-year board questions for this subject.