Anjeev Singh Academy

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

Type B: Application-Based Questions

1. What is the significance of data visualization?

Ans: Data visualization helps in understanding the importance and significance of data visually. With the help of visualization technique patterns, trends and correlations can be exposed and recognized easier.

2. How does Python support data visualization?

Ans: Python support data visualization with the help of library. A most common and popular visualization library is matplotlib. Matplotlib has one interface named pyplot which helps in constructing 2D plot types like line chart, bar chart, scatter chart, pie chart, histogram etc.

3. What is the use of matplotlib and pyplot?

Ans: Matplotlib is a Python library known as plotting library. It has a rich set of interface which helps in plotting 2D or 3D plots and output formats.

Pyplot is a one of the interface of matplotlib library, which can be used for 2D plot types and output formats. It supports various types charts like bar, pie, hist, line, scatter, etc.

4. What are the popular ways of plotting data?

Ans: The popular ways of plotting data are –

(i) Line Chart

(ii) Bar Chart

(iii) Pie Chart

(iv) Scatter Chart

(v) Histogram

(vi) Box Plot

5. Compare bar() and barh() functions.

Ans: bar( ) function of pyplot interface is use to plot a vertical bar chart while barh( ) function of pyplot is use to plot the horizontal bar chart.

6. What is the role of legends in a graph/chart?

Ans: Legend is a colour or mark which linked to a specific data range plotted. It helps in identification of data or range, when you plot multiple ranges on a single plot. legend() function of pyplot is use to show the legend with an optional argument loc.

The label argument must be used inside the plot(), bar() etc function. If you have not mentioned the label argument, then you will get an error message with the legend argument.

7. What will happen if you use legend() without providing any label for the data series being plotted?

Ans: An error message is shown – No handles with labels found to put in legend.

8. What do you understand by xlimit and ylimit? How are these linked to data being plotted?

Ans:  Limits means range of values and number of values marked on X-axis and Y-axis.

Xlimit specify the limits for the x-axis, i.e. the tick values shown on the x-axis, while

Ylimit specify the limits for the y-axis, i.e. the tick values shown on the y-axis.

If you do not specify the x or y limits, PyPlot will automatically decide the limits for X and Y axes as per the values being plotted.

While setting up the limits for axes, the data that falls into the limits of X and Y-axes will be plotted; rest of data will not show in the plot. It means that, if you specify X-axis or Y-axis limits which are not compatible with the data values being plotted, you may either get incomplete plot or the data being plotted is not visible to all.

9. When should you use 

(i) a line chart, (ii) a bar chart, (iii) a scatter chart, (iv) pie chart, (v) boxplot

Ans: The following charts are used for –

(a) Line Chart: Line chart is use to show the flow of data or trend of data.

(b) Bar Chart: is use to compare the data and to represent categorised data.

(c) Scatter Chart: is use to show the trend of data. It is use to show the relationship between two sets of data.

(d) Pie Chart: is use to represent numerical proportional in the form of slice. It is use to show the parts to the whole.

(e) BoxPlot Chart: is use to show the visual representation of the statistical five number summary of a given data set.

10. A list namely temp contains average temperatures for seven days of last week. You want to see how the temperature changed in last seven days. Which chart type will you plot for the same and why?

Ans: We can use line chart, to represent the changes in the temperature in last seven days. Because Line charts are excellent for mapping continuous data sets over a period of time.

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

Scroll to Top