JavaScript isn't enabled in your browser, so this file can't be opened. Enable and reload.
Python Quiz on Matplotlib
There are
20 questions based on Matplotlib Library in Python.
Sign in to Google
to save your progress.
Learn more
* Indicates required question
Q1. What does the following code display?
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4])
plt.show()
*
4 points
A bar chart
A line graph
A scatter plot
Nothing
Q2. What is the default x-axis in the code ?
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4])
plt.show()
*
4 points
[0, 1, 2, 3]
[1, 2, 3, 4]
[1, 3, 5, 7]
Random values
Q3. What does this code do?
plt.title("My Graph")
*
4 points
Sets the y-axis label
Sets the x-axis label
Adds a legend
Sets the graph title
Q4 Which command sets the x-axis label?
*
4 points
plt.xlabel("X")
plt.xaxis("X")
plt.axis.x("X")
plt.labelx("X")
Q5. What will this code display?
plt.plot([1,2,3],[4,5,6],'ro')
plt.show()
*
4 points
A red line
Red circles
Blue line
Green squares
Q6. What does 'r--' mean in plt.plot(x, y, 'r--')?
*
4 points
Red solid line
Red dotted line
Red dashed line
Random color line
Q7. What function adds a legend to a plot?
*
4 points
plt.legend()
plt.add_legend()
plt.show_legend()
plt.display_legend()
Q8. What does this code do?
plt.subplot(2,1,1)
*
4 points
Creates 2 subplots horizontally
Creates 2 subplots vertically and activates the 1st one
Creates a single plot
None
Q9. What will this code produce?
*
4 points
Line graph
Scatter plot
Bar chart
Histogram
Q10. What is the purpose of plt.grid(True)?
*
4 points
Adds gridlines
Adds legend
Removes axes
Changes color
Q11. Which function displays the plot on screen?
*
4 points
plt.display()
plt.plot()
plt.show()
plt.open()
Q12. What will this code do?
plt.scatter([1,2,3],[4,5,6])
*
4 points
Line graph
Bar chart
Scatter plot
Histogram
Q13. How can you save a figure to a file?
*
4 points
plt.save("figure.png")
plt.savefig("figure.png")
plt.savefile("figure.png")
plt.store("figure.png")
Q14. Which function clears the current figure?
*
4 points
plt.clear()
plt.clf()
plt.close()
plt.clean()
Q15. Which function closes the figure window?
*
4 points
plt.clf()
plt.clear()
plt.close()
plt.exit()
Q16. What does this code produce?
plt.hist([1,1,2,3,3,3,4])
plt.show()
*
4 points
Scatter plot
Bar chart
Histogram
Line plot
Q17. What does this code do?
plt.figure(figsize=(6,4))
*
4 points
Creates a new figure of given size
Sets axes size
Changes DPI
Zooms the plot
Q18. Which command changes line width?
*
4 points
linewidth
width
lw
Both A and C
Q19. What does plt.axis('equal') do?
*
4 points
Equal axis limits
Equal x and y spacing
Equal aspect ratio
Equal plot size
Q20. What happens if you run plt.plot() without arguments?
*
4 points
Empty plot is created
Error
Random line is drawn
Closes plot
Submit
Clear form
Forms
This content is neither created nor endorsed by Google.
Report Abuse
Terms of Service
Privacy Policy
Help and feedback
Contact form owner
Help Forms improve
Report