Plotting with pyplot Assignments Class-12 is one of the topic of CBSE curriculum, subject – Informatics Practices code 065. In this article you will get the assignments for the same.
Objective type questions (Plotting with pyplot Assignments Class-12)
MCQs, Fill in the blanks and True/False
Q – 1 A _________ refers to the graphical representation of data and information using charts or diagrams or maps.
–> Data Visualization
Q – 2 Data visualization helps to
a) Understand data easily
b) Take a decisions
c) Improve the past performance
d) All of these
Q – 3 The ______ module allows you to represent data visually in various forms.
Q – 4 The ________ library provides the interface and functionality for plotting the graphs.
Q – 5 Which of the following offers many different names collections of methods?
Q -6 Which of the following correct statement to import pyplot module?
a) import matplotlib.pyplot
b) import MatPlotLib.PyPlot
c) import PyPlot as pl
d) import pyplot.plot
Q – 7 A __________ chart displays information as a markers connected by a straight lines.
Q – 8 A bar chart is also known as column chart. (True/False)
Q – 9 The entire is covered by the graph is known as __________
–> Figure or Chart Area
Q – 10 Which is a common method used to plot data on the chart?
Q – 11 Which of the following is/are correct statement for plot method?
d) all of these
Q – 12 What are the mandatory parameters to plot data on chart for plot() method?
a) x and y
d) None of these
Q – 13 To give a title to x-axis, which of the following method is useful?
Q – 14 The pl.show() method must be used to display the chart in the end of the chart specification. (True/False)
Q – 15 The _________ method is used to create a line chart.
Q – 16 To create a horizontal bar chart, bar() function is used. (True/False)
Q – 17 To change the width of bars in bar chart, which of the following argument with a float value is used?
Q – 18 You can set different width for different bars in bar chart. (True/False)
Q – 19 To apply color you can only specify the color names. (True/False)
Q – 20 Which method is used to display or show the legends?
The following section contains short answer questions for Plotting with pyplot Assignments Class-12.
Descriptive questions (2/3 marks)
Q – 1 What do you mean by data visualization technique?
The data visualization technique refers to the graphical or pictorial or visual representation of data. This can be achieved by charts, graphs, diagrams, or maps.
Q – 2 How data visualization can help in decision making?
Mostly data visualization technique provides data in form of charts or graphs. These charts majorly used in producing various reports like trends, outliers, and other diagrams. By observing these all user can understand the data easily and he/she can take his decision.
Q – 3 Name the library and interface used to plot a chart in python.
Library – matplotlib
interface – pyplot
Q – 4 What are the ways of importing matplotlib?
You can import matplotlib in following two ways:
- Using alias name: import matplotlib.pyplot as pp
- Without alias name: import matplotlib.pyplot
Q -5 What are the basic elements/components of the chart?
The chart has following elements/components:
- Chart area or figure
Q -6 Write steps to plot your data on a graph.
- import module i.e import matplolib.pyplot as pp
- Choose the desired chart type to plot data. For ex. Line chart
- Use proper titles for axis
- Add data points
- Add more properties to the graph like color, size etc.
Q – 7 What types of graphs can be plotted using matplotlib?
The matplotlib provides following types of charts:
- Line chart
- Bar chart
- Horizontal bar chart
- Scatter chart
- Pie Chart
Q – 8 Write code to do the following: Plot the following data on line chart:
|Runs in Overs||10||20|
 Write code to plot a line chart to depict the run rate of T20 match from given data:
import matplotlib.pyplot as mpp overs = [10,20] mi = [110,224] mpp.plot(overs,mi,'blue') rcb=[109,210] mpp.plot(overs,rcb,'red') mpp.xlabel('Runs') mpp.ylabel('Overs') mpp.title('Match Summary') mpp.show()
import matplotlib as pp overs = [5,10,15,20] runs = [54,79,145,234] pp.plot(overs,runs) pp.xlabel('Overs') pp.ylabel('Runs') pp.show()
Q – 9 How to change the thickness of line, line style, line color, and marker properties of a chart?
To change the thickness of line, use the linewidth parameter inside matplotlib.pyplot.plot() function with a numeric value. For ex.: pp.plot(x,y,linewidth=2)
To change the line style, use linestyle or ls parameter. This linestyle can be one of the following:
To change the color use color shortcode like r for red, g for green and so on. You can also use the complete colornames or hexadecimal color codes like #000800 in RGB values. Click here to know more about line colors.
To change the markers user marker properties as following: markertype: It can be a symbol such as . (dot), ‘D’ for diamond etc. Click here for more about marker types.
Ex.: pp.plot(x,y,marker=’D’) markersize: It can be a numeric value.
Ex. pp.plot(x,y,marker=’D’,markersize=4) markeredgecolor: It can be a color shortcode or color name or color code.
Q – 10 Plot following data on bar graph:
import matplotlib.pyplot as pp eng = [56,78,90,34] sci = [65,77,54,32] maths =[45,67,43,41] pp.bar(eng,sci,maths) pp.xlabel('Marks') pp.ylabel('Subjects') pp.show()
Read this also: Informatics Practices