Reviiosn Notes of Matplotlib-XII

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

PYTHON & GRAPH REVISION NOTES

Q1. Which library is import to make graphs?

Ans: matplotlib

Q2. What is matplotlib?

Ans: it is a 2-D plotting library that helps in visualizing data into graphs.

Q3. Which module of matplotlib library used for graphs?

Ans: pyplot

Q4. How many types of graphs ?

Ans: line,bar,histogram

Q5. Write import statement for graphs.

Ans: import matplotlib.pyplot as plt

Q6. Name any three functions of pyplot.

Ans: plt.line(),plt.hist(),plt.bar(), plt.title(), plt.yaxis() etc.

Q7. Which function used to display the graph?

Ans: show() or plt.show()

Q8. Can we save graphs?

Ans: Yes

Plt.savefig(“d:\figure1.jpg”)

Plt.savefig(“d:\figure1.png”)

Plt.savefig(“d:\figure1.bmp”)

Plt.savefig(“d:\figure1.pdf”)

Q9. Which functions used for plotting different graphs?

Ans: line- plot()

Bar- bar()

Histogram- hist()

Q10. Difference between bar and histogram?

Ans: different bars with spaces in bar graph.

Histogram bars without space.


Q11. What is markers in line chart?

Ans: where x-axis and y axis points intersect we use markers for it.

Markers can be-

star- ‘*’

circle- “O”

diamond- “D”

Q12. What is linestyle in line chart?

Ans: we can create different type of lines.

Solid- ‘-‘

Dashed line ‘- -'

Dash-dot ‘-.’

Dotted line ‘:’

Q13. What are different codes for color?

Ans:

‘b’ – blue

‘y’- yellow

‘g’- green etc.

Q14. Can we plot multiple lines in same graph?

Yes: by using multiple plt.plot() function.

Q15. What is a line chart used for?

A line chart, also referred to as a line graph or a line plot, connects a series of data points using a
line. This chart type presents sequential values to help you identify trends. Most of the time, the x-
axis (horizontal axis) represents a sequential progression of values.

Q16. What is a bar chart used for?

Bar charts are used to present categorical data with rectangular bars. The bars can be plotted
vertically or horizontally, and their heights/lengths are proportional to the values that they
represent. Matplotlib is the library used for 2D plots of arrays in Python.
Q17. What is a histogram chart used for?

A histogram is a graph showing frequency distributions. It is a graph showing the number of


observations within each given interval.

Q18. What is the minimum number of arguments required for plot() function in matplotlib?

Ans: 1

Q19. Which graph should be used where each column represents a range of values, and the height
of a column corresponds to how many values are in that range?

Ans: Histogram

You might also like