★★★★★
"The one step solution for my son. Modern Age Coders make learning coding so simple that kids love it. The teachers explain complex concepts clearly with practical exercises and interactive content."
Ria Mukherjee
Parent
CBSE Class 12 · Informatics Practices, code 065 · Data visualization
Data visualization in Class 12 IP is a short chapter with an honest reward: one four-mark program whose lines you can know in advance. The syllabus has only a line plot, a bar graph and a histogram. Below, each is drawn from fresh data, the picture is the very file the code saved, and beside every chart is the sentence it lets you say.
Live one to one · seven real charts with their code · four-mark answer marked · hours of your choice
Start here
A chart is only as good as the table under it. These courses keep the two together, beginning with the board subject.

065 / With pandas
Line charts, bar graphs and histograms follow DataFrames, then CSV data is charted and both are revised with practical programs.
Open the course →
Beyond the syllabus
A month of matplotlib on distributions, choosing the right chart and honest figures, ending with a four-chart story.
Open the course →
Where data is kept
Totals and groups that you would plot often come from a query first. Useful for the SQL unit and for projects.
Open the course →Ans. The short version
Class 12 IP data visualization (CBSE 065) is the part of Unit 1 where you show data as pictures using Matplotlib. The 2026-27 syllabus has three plots: line plot with plt.plot(), bar graph with plt.bar() and histogram with plt.hist(), customised by a title, axis labels and a legend, and saved with plt.savefig(). The sample paper asks a four-mark line graph program. Modern Age Coders teaches this live, personalised one to one, on your own timetable; a priority demo is a full class you can try before enrolling.
A. Before any code
Data visualization means showing data as charts so that a change, a comparison or a pattern can be seen without reading every number. Its purpose is to help people draw conclusions.
| Your data | The question | Plot | Function |
|---|---|---|---|
| Values in an order: days, weeks, months | How did it change? | Line plot | plt.plot(x, y) |
| One value for each named thing | Which is more, which is less? | Bar graph | plt.bar(names, values) |
| One long list of numbers | How are they spread? | Histogram | plt.hist(values, bins=...) |
| Function | What it does | A slip and its result |
|---|---|---|
import matplotlib.pyplot as plt | Brings in the plotting functions | import matplotlib as plt, then plt.plot: AttributeError |
plt.title("...") | Heading above the chart | Called twice, the second replaces the first |
plt.xlabel("..."), plt.ylabel("...") | Names the axes, with units | plt.xlable: AttributeError |
label="..." inside the plot call | Names one line or one set of bars | Without legend() it is never shown |
plt.legend() | Draws the box that lists the labels | With no label given: a warning and an empty box |
plt.savefig("a.png") | Saves the figure; PNG and PDF both work | An unknown ending such as .xyz: ValueError |
plt.show() | Displays the figure | Forgotten in the paper: half a mark |
Save first, show after. When a figure is closed, the next savefig() starts a new, empty one. We closed a figure and then saved: the file was a plain white image.
B. Change over an order
Give plt.plot() two lists of equal length, x first and y second, then add the title, the axis labels and, if there is more than one line, a legend.
import matplotlib.pyplot as plt
day = [0, 3, 6, 9, 12, 15]
height = [0, 1.5, 4, 8.5, 13, 16]
plt.figure(figsize=(8, 5)) # size in inches
plt.plot(day, height)
plt.title("Height of one bean seedling")
plt.xlabel("Day")
plt.ylabel("Height (cm)")
plt.savefig("01-line-seedling.png", dpi=150)
plt.show()
Read it: growth is slow until day 3, quickest from day 6 to day 12, and a little slower at the end.
import matplotlib.pyplot as plt
day = [0, 3, 6, 9, 12, 15]
compost = [0, 1.5, 4, 8.5, 13, 16]
plain = [0, 1.5, 3.5, 6, 8, 9.5]
plt.figure(figsize=(8, 5))
plt.plot(day, compost, color="seagreen", marker="o",
label="With compost")
plt.plot(day, plain, color="sienna", marker="s",
linestyle="--", label="Plain soil")
plt.title("Bean seedlings in two kinds of soil")
plt.xlabel("Day")
plt.ylabel("Height (cm)")
plt.legend()
plt.savefig("02-line-two-soils.png", dpi=150)
plt.show()
Read it: both are equal till day 3. By day 15 the compost seedling is 6.5 cm taller.
Two plot() calls before one show() share the same axes. The colour, marker and linestyle are extras: the syllabus asks for label, title and legend. If the lists differ in length, Matplotlib stops with ValueError. If you pass one list, it becomes y, and x is 0, 1, 2 and so on.
C. Comparing named things
plt.bar() takes the names for the x-axis first and the heights second. The bars stand apart because the names are separate categories.
import matplotlib.pyplot as plt
classes = ["VI", "VII", "VIII", "IX", "X"]
paper_kg = [46, 38, 52, 27, 33]
plt.figure(figsize=(8, 5))
plt.bar(classes, paper_kg, width=0.6, color="seagreen",
label="Waste paper")
plt.title("Waste paper collected for recycling")
plt.xlabel("Class")
plt.ylabel("Paper (kg)")
plt.legend()
plt.savefig("03-bar-paper.png", dpi=150)
plt.show()
Read it: class VIII collected the most, 52 kg, and class IX the least, 27 kg.
import pandas as pd
import matplotlib.pyplot as plt
drive = pd.DataFrame([
{"Class": "VI", "Kg": 46, "Students": 40},
{"Class": "VII", "Kg": 38, "Students": 38},
{"Class": "VIII", "Kg": 52, "Students": 52},
{"Class": "IX", "Kg": 27, "Students": 18},
{"Class": "X", "Kg": 33, "Students": 30}])
drive.to_csv("drive.csv", index=False)
drive = pd.read_csv("drive.csv") # as in the lab
drive["Each"] = drive["Kg"] / drive["Students"]
print(drive)
plt.figure(figsize=(8, 5))
plt.bar(drive["Class"], drive["Each"], color="sienna")
plt.title("Waste paper per student")
plt.xlabel("Class")
plt.ylabel("Paper per student (kg)")
plt.savefig("04-bar-per-student.png", dpi=150)
plt.show()
Read it: class IX, last in the first chart, is first per student.
Class Kg Students Each 0 VI 46 40 1.15 1 VII 38 38 1.00 2 VIII 52 52 1.00 3 IX 27 18 1.50 4 X 33 30 1.10
The two charts use one table and give opposite winners. Suggested practical 5.2 asks you to analyse a DataFrame and plot it with a title and legend, and a new column is often where the analysis is. width is 0.8 when you do not give it.
D. How values are spread
A histogram groups one list of numbers into ranges called bins and draws a bar as tall as the number of values in each bin. A bar graph compares separate names; a histogram shows the spread of one quantity.
import matplotlib.pyplot as plt
grams = [182, 190, 205, 211, 214, 218, 222, 225, 226, 231,
233, 235, 238, 240, 241, 244, 247, 252, 255, 258,
263, 268, 274, 280, 291]
edges = [180, 200, 220, 240, 260, 280, 300]
plt.figure(figsize=(8, 5))
result = plt.hist(grams, bins=edges, color="seagreen",
edgecolor="black")
print(result[0]) # how many in each bin
plt.title("Weights of 25 mangoes from one tree")
plt.xlabel("Weight (g)")
plt.ylabel("Number of mangoes")
plt.savefig("05-hist-mangoes.png", dpi=150)
plt.show()
Read it: 14 of the 25 mangoes weigh from 220 g to just under 260 g.
[2. 4. 7. 7. 3. 2.]
| Bin | Values that fall in it | Count |
|---|---|---|
| 180 to below 200 | 182, 190 | 2 |
| 200 to below 220 | 205, 211, 214, 218 | 4 |
| 220 to below 240 | 222, 225, 226, 231, 233, 235, 238 | 7 |
| 240 to below 260 | 240, 241, 244, 247, 252, 255, 258 | 7 |
| 260 to below 280 | 263, 268, 274 | 3 |
| 280 to 300 | 280, 291 | 2 |
240 and 280 sit on an edge and go to the bin on their right. Only the last bin includes both ends. A value outside all the edges is left out without any message, so check that the counts add up to the size of the list: here, 25.
import matplotlib.pyplot as plt
grams = [182, 190, 205, 211, 214, 218, 222, 225, 226, 231,
233, 235, 238, 240, 241, 244, 247, 252, 255, 258,
263, 268, 274, 280, 291]
plt.figure(figsize=(8, 5))
result = plt.hist(grams, bins=3, color="sienna",
edgecolor="black")
print(result[0])
print(result[1]) # the edges it chose
plt.title("The same mangoes in three bins")
plt.xlabel("Weight (g)")
plt.ylabel("Number of mangoes")
plt.savefig("06-hist-three-bins.png", dpi=150)
plt.show()
Read it: the middle is still tallest, but the detail has gone. With bins left out, Matplotlib uses 10.
[ 6. 12. 7.] [182. 218.33333333 254.66666667 291. ]
| Point | Bar graph | Histogram |
|---|---|---|
| Data | Names and a value for each | One list of numbers |
| x-axis | Separate categories | A continuous scale cut into bins |
| Height of a bar | The value itself | How many values fall in the bin |
| Gaps | Bars stand apart | Bars touch |
| Order of bars | Can be changed | Fixed by the number scale |
| Example | Kilograms from each class | Weights of 25 mangoes |
E. In the answer book
The 2026-27 scheme gives 1 mark for the import, 1 for plot() with the label and half a mark each for title, axis labels, legend and show(). Data for an original one: skips in a minute over five weeks.
import matplotlib.pyplot as plt # 1 mark
week = ["W1", "W2", "W3", "W4", "W5"]
skips = [42, 55, 51, 68, 74]
plt.figure(figsize=(8, 5))
plt.plot(week, skips, marker="o", label="Skips") # 1
plt.title("Rope skipping practice") # 1/2
plt.xlabel("Week")
plt.ylabel("Skips in a minute") # 1/2
plt.legend() # 1/2
plt.savefig("07-line-skips.png", dpi=150)
plt.show() # 1/2
The figure() and savefig() lines are for the computer. In the paper, write them only if you are asked to set a size or save. The y-axis does not begin at 0, so read the numbers and not only the slope.
plt.xlabel()plt.______(). binsplt.bar(a, b) used for? plt.savefig("trend.png")import matplotlib as plt
fruit = ["Guava", "Papaya", "Chikoo"]
sold = [25, 18]
plt.bar(fruit, sold, label="Sold")
plt.Title("Fruit sold on Monday")
plt.xlable("Fruit")
plt.legend
plt.show()import matplotlib.pyplot as plt; a third value in sold; plt.title with a small t; plt.xlabel; and round brackets after legend. The last slip gives no error: the box is simply missing.plt.bar(["R1", "R2", "R3", "R4", "R5"], [4, 7, 3, 6, 5]); title; xlabel and ylabel; plt.savefig("routes.png"); show.plt.hist(d["Minutes"], bins=[0, 15, 30, 45, 60, 75, 90]) with labels Minutes and Number of people.plt.plot() with its own label before plt.legend(). Nothing else changes.The file needs at least four Matplotlib programs, and a viva can start at a chart: why this plot, why these bins, what does the fall in week three mean? A complete set with output is in the Class 12 IP practical file, and spoken answers are in IP viva questions.
The student draws the expected chart roughly on paper. A wrong choice of plot is noticed there, and not after ten lines of typing.
No chart is finished until the student has said what it shows, with a number in the sentence.
Import, plot, title, labels, legend, show: written by hand for a new set of data at the start of class until it is automatic.
Charts usually begin with a table, so revise DataFrames and Series beside this page. For a full project built on charts see the IP project with source code.
One to one, at your own timing
Typing plt.bar is quick. Explaining why it should have been plt.hist takes a conversation, and that is what a personalised one to one class is. You decide the days and the time. To see one, take a priority demo: it is a paid full class, and if you enrol the amount is counted in the first month. Or take the free demo class. We bill month by month, there is no admission fee, and you are free to stop when a month ends.
Before you enrol · Try a class
a full live class of about 45 to 60 minutes
The classes · Choose your own timing
₹4,999
per month, 4 private classes, fully flexible timingtwo private classes a week, at a time set with you
Data visualization can be finished in a few classes, so the rest of the month can go to SQL or DataFrames. What a month costs is printed on this page in your own currency.
Studying outside India?
CBSE schools in Riyadh, Doha and Singapore use the same three plots. Choose a time that falls after your school and before your dinner.
| Where you live | Time difference | Usual class window, local time | Format |
|---|---|---|---|
| India every Indian city | Indian time | Any time you choose | Personalised 1-on-1 |
| UAE and Oman Dubai, Abu Dhabi, Sharjah, Muscat | 1 h 30 min behind India | 3:00 PM to 9:00 PM | Personalised 1-on-1 |
| Saudi Arabia, Qatar, Kuwait, Bahrain Riyadh, Jeddah, Dammam, Doha, Kuwait City, Manama | 2 h 30 min behind India | 3:00 PM to 9:00 PM | Personalised 1-on-1 |
| Nepal Kathmandu | 15 min ahead of India | 4:30 PM to 9:00 PM | Personalised 1-on-1 |
| Ethiopia and East Africa Addis Ababa and East Africa Time | 2 h 30 min behind India | 4:30 PM to 9:00 PM | Personalised 1-on-1 |
| Singapore and Malaysia Singapore, Kuala Lumpur | 2 h 30 min ahead of India | 3:30 PM to 9:00 PM | Personalised 1-on-1 |
You need Python with pandas and Matplotlib. Installation trouble is common, so mention it when you book and the first class starts there.
What families say
Real reviews from real families. We neither write nor commission them.
★★★★★
"The one step solution for my son. Modern Age Coders make learning coding so simple that kids love it. The teachers explain complex concepts clearly with practical exercises and interactive content."
Ria Mukherjee
Parent
★★★★★
"Modern Age Coders has been a game-changer for me. I struggled to grasp IT concepts and coding before joining, but their classes transformed everything. I can now confidently write complex programs with ease."
Samriddha Mondal
Student
★★★★★
"One of the most wonderful education centres out there. Education is not limited to school syllabus but focuses on skill development."
Vansh Agarwal
Student
★★★★★
"My child Dhairya is really enjoying the Modern Age Coders classes. This is his first online class and he eagerly looks forward to it. I can already see his improvement, and the teachers are very cooperative."
Sonam Oswal
Parent of Dhairya
★★★★★
"Modern Age Coders have wonderful teachers who teach in a clear, easy and practical way. The teacher boosts students' confidence and inspires them to learn without hesitation."
Sonu Goyal
Parent
★★★★★
"I highly recommend this computer coding class! The teachers are incredibly knowledgeable and passionate about coding."
Ritu Kedia
Parent
The rest of the Class 12 series
Every page in the CBSE Class 12 Informatics Practices series, grouped by what you need.
CBSE Class 12 Computer Science (083): Class 12 CS viva questions Class 12 CS sample paper practice Class 12 CS project with source code Class 12 CS important questions
CBSE Class 12 Information Technology (802): IT 802 practical and project file IT 802 Java notes and programs IT 802 notes
CBSE Class 11 CS, IP and AI: Class 11 CS practical file Class 11 IP practical file CS or IP in Class 11
ISC Computer Science (868): ISC Class 12 CS syllabus 2027 ISC Class 12 CS practice paper ISC Class 12 practical questions solved ISC Boolean algebra and K-maps
Program lists with output: Class 12 practical file programs Python programs for Class 11 CS and IP
Questions about charts
Data visualization is the representation of data in the form of charts and graphs. In CBSE Informatics Practices 065 it is part of Unit 1 and is done with the Matplotlib library in Python. Its main purpose is to show trends, comparisons and the spread of values so that a reader can draw conclusions easily.
Three: line plot, bar graph and histogram. The syllabus also lists drawing and saving these plots, and customising them by adding a label, a title and a legend. Pie charts, scatter plots and box plots are not on the Class XII list for this session.
Matplotlib is a Python library for drawing charts. pyplot is the module inside it that has simple functions such as plot(), bar(), hist(), title() and show(). It is imported with import matplotlib.pyplot as plt, and plt is only the usual short name.
A bar graph compares separate categories, and each bar shows the value of one category. A histogram shows how one set of numbers is distributed: the x-axis is divided into ranges called bins and each bar shows how many values fall inside. The bars of a histogram touch each other.
Bins are the ranges into which the values are grouped. bins=3 asks for three equal ranges between the smallest and largest value. A list such as [180, 200, 220] sets the edges yourself. Each bin includes its left edge and not its right one, except the last bin, which includes both.
Give each plot a label, as in plt.plot(x, y, label="Sales"), and then call plt.legend() once before plt.show(). A label without legend() is not displayed, and legend() without any label shows an empty box and a warning.
Call plt.savefig("chart.png") before plt.show(). You may add dpi=150 for a sharper picture, and a name ending in .pdf also works. If you save after the figure has been closed, the file is blank.
It shares 25 marks with pandas. In the 2026-27 sample paper, Question 4 (1 mark), Question 24 (2 marks) and Question 33 (4 marks) are on this topic, which makes 7. In the practical, pandas and Matplotlib programs together carry 8 of the 30 marks.
Pass the columns to the plotting function: plt.bar(drive["Class"], drive["Kg"]) or plt.hist(d["Minutes"]). A column is a Series, and Matplotlib accepts it like a list. Import both pandas and matplotlib.pyplot at the top.
Write them only when the question asks. The official scheme for the line graph gives marks for import, plot with label, title, axis labels, legend and show. Extras are not in that scheme, so finish the listed lines first.
In a script, check that plt.show() is there with its brackets. Check the import line too, since import matplotlib alone does not give you plot(). If the window opens and is empty, the plot call probably came after show().
Yes. The class is live, for one student, at the time you choose, and you draw every chart yourself. Try a priority demo of about 45 to 60 minutes first, with a written skill report after it and the fee adjusted in your first month if you enrol, or take a free demo class.
Start
Come to the free demo class with any numbers you find interesting: cricket scores, bus timings, pocket money. Choosing the plot for them is the first exercise.
A priority demo covers more ground. You choose the slot, draw all three plots from new data, write the four-mark program by hand, and get a written skill report; the demo fee is adjusted against the first month if you go on.
More topics for a longer piece of work are on Class 12 IP project topics.
WhatsApp us · +91 91233 66161 · connect@modernagecoders.com
Every class is live video. The form requests a callback and reserves nothing.
A full live class of about 45 to 60 minutes at a slot you pick, with a written skill report and learning roadmap on WhatsApp afterwards. The fee is adjusted against your first month if you enrol.
Book a priority demo