Anjeev Singh Academy

# Class 12 Informatics Practices 065 Ch 3 Plotting with PyPlot Sumita Arora Book Exercise Solution

### Ch 3 Plotting with PyPlot

Sumita Arora Book Exercise Solution

#### 1. Name the library of which the PyPlot is an interface.

Ans: Matplotlib

##### 2. Write the statement to import PyPlot in your script.

Ans: import matplotlib.pyplot

OR

import matplotlib.pyplot as plt

##### 3. Name the functions to create the following:

(a) line chart       (b) bar chart       (c) horizontal bar chart  (d) histogram

(e) scatter chart (t) boxplot           (g) pie chart

Ans:       (a) plot( )

(b) bar( )

(c) barh( )

(d) hist( )

(e) scatter( ) or plot( )

(f) boxplot( )

(g) pie( )

##### 4. What is a line chart?

Ans: Line Chart is a type of chart which displays information as a series of data points called ‘markers’ connected by straight line segments. A plot( ) function is used to make line chart.

##### 5. What is a scatter chart?

Ans: Scatter chart is a graph of plotted points on two axes that show the relationship between two sets of data. A scatter( ) method of pyplot interface is use to make the scatter chart. A scatter chart can be created by using plot( ) method also.

##### 6. What is a pie chart?

Ans: Pie chart is a type of chart or graph in which a circle is divided into sections that each represent a proportion of the whole. A pie() method of pyplot interface is use to make pie chart.

##### 7. What is a bar chart?

Ans: Bar chart is a type of graph or chart, which represent the numerical data graphically using bars of different height. It can draw vertically or horizontally. A bar() and barh( ) method of pyplot interface is use to create bar chart.

##### 8. What is a histogram?

Ans: Histogram is a summarisation tool for discrete or continuous data.

##### 9. What is a boxplot?

Ans: A histogram is basically used to represent data provided in a form of some groups. It is accurate method for the graphical representation of numerical data distribution.

##### 10. What is a frequency polygon?

Ans: Frequency polygon is a type of frequency distribution graph. In this, number of observations is marked with a single point at the midpoint of an interval. A straight line then connects each set of points.

##### 11. Name the function to label axes.

Ans: xlabel( ) and ylabel( )

Ans: title( )

##### 13. Name the function to set figure size of a plot.

Ans: figure(figsize=(w, l))

##### 14. Name the function to set limits for the axes.

Ans: matplotlib.pyplot.xlim( ), matplotlib.pyplot.ylim( )

##### 15. Name the function to show legends on a plot.

Ans: matplotlib.pyplot.legend(loc=value)

or

plt.legend()

##### 16. Name the function to add ticks on axes.

Ans: For x-axis:

matplotlib.pyplot.xticks(sequence tick data points [, sequence tick lable])

For y-axis:

matplotlib.pyplot.yticks(sequence tick data points [, sequence tick lable])

Sorry! You cannot copy content of this page. Please contact, in case you want this content.

Scroll to Top