Matplotlib
Matplotlib
**
- a) Data processing
- b) Data visualization
- c) Machine learning
- d) Statistical analysis
- a) plt.bar()
- b) plt.scatter()
- c) plt.plot()
- d) plt.hist()
**Answer**: c) plt.plot()
- a) plt.scatter()
- b) plt.plot()
- c) plt.line()
- d) plt.pie()
**Answer**: a) plt.scatter()
- a) plt.save()
- b) plt.export()
- c) plt.savefig()
- d) plt.write()
**Answer**: c) plt.savefig()
- a) 6x4 inches
- b) 8x6 inches
- c) 10x8 inches
- d) 5x5 inches
- a) plt.grid()
- b) plt.show_grid()
- c) plt.add_grid()
- d) plt.set_grid()
**Answer**: a) plt.grid()
- a) Bar chart
- b) Line chart
- c) Pie chart
- d) Scatter plot
- a) plt.color()
- b) plt.line_color()
- c) plt.plot(color='red')
- d) plt.set_color('red')
**Answer**: c) plt.plot(color='red')
- a) plt.subplot()
- b) plt.subplots()
- c) plt.grid()
- d) plt.add_subplot()
**Answer**: b) plt.subplots()
- a) plt.title('My Plot')
- b) plt.set_title('My Plot')
- c) plt.plot_title('My Plot')
- a) plt.scatter()
- b) plt.plot()
- c) plt.hist()
- d) plt.bar()
**Answer**: c) plt.hist()
---
- a) plt.boxplot()
- b) plt.bplot()
- c) plt.scatter()
- d) plt.plot()
**Answer**: a) plt.boxplot()
- a) plt.style.use('ggplot')
- b) plt.set_style('ggplot')
- c) plt.style('ggplot')
- d) plt.change_style('ggplot')
**Answer**: a) plt.style.use('ggplot')
- a) marker='x' in plt.plot()
- b) plt.marker()
- c) plt.set_marker('x')
- d) marker_type='x' in plt.plot()
- a) Circle
- b) Square
- c) No marker
- d) Triangle
**Answer**: c) No marker
- a) alpha
- b) transparency
- c) opacity
- d) set_alpha()
**Answer**: a) alpha
- a) Using `mpl_toolkits.mplot3d`
- b) Using `plt.plot3d()`
- c) Using `plt.three_d()`
- d) Using `plt.show_3d()`
- a) plt.annotate()
- b) plt.text()
- c) plt.label()
- d) plt.point()
**Answer**: a) plt.annotate()
- c) Using `plt.multi_plot()`
13. **What type of plot is best used for visualizing the relationship between two continuous
variables?**
- a) Bar plot
- b) Pie chart
- c) Line plot
- d) Scatter plot
14. **Which function would you use to plot error bars in Matplotlib?**
- a) plt.errorbar()
- b) plt.bar()
- c) plt.scatter()
- d) plt.plot_error()
**Answer**: a) plt.errorbar()
-a
---
1. **Which of the following commands can be used to modify the tick parameters in a plot?**
- a) plt.tick_params()
- b) plt.set_ticks()
- c) plt.modify_ticks()
- d) plt.adjust_ticks()
**Answer**: a) plt.tick_params()
2. **What is the function used to create a histogram with normalized values in Matplotlib?**
- a) plt.hist(normalize=True)
- b) plt.hist(density=True)
- c) plt.hist(scale=True)
- d) plt.hist(norm=True)
**Answer**: b) plt.hist(density=True)
- a) plt.pcolor()
- b) plt.imshow()
- c) plt.heatmap()
- d) Both a and b
- a) plt.plot()
- b) mpld3
- c) plt.scatter()
- d) plt.show()
**Answer**: b) mpld3
- a) Using `plt.twiny()`
- b) Using `plt.twinx()`
- c) Using `plt.add_yaxis()`
- d) Using `plt.secondary_y()`
- a) Using `plt.subplots_adjust()`
- b) Using `plt.spacing()`
- c) Using `plt.tight_layout()`
- d) Both a and c
- a) viridis
- b) plasma
- c) coolwarm
- d) rainbowz
**Answer**: d) rainbowz
9. **What is the output of `plt.hist([1, 2, 1, 1, 3, 2], bins=3)`?**
- a) A line plot
- b) A bar plot
- d) An error
10. **What method is used to modify the appearance of grid lines in a plot?**
- a) plt.grid_color()
- b) plt.set_grid()
- d) plt.modify_grid()
- a) plt.yscale('log')
- b) plt.set_yscale('log')
- c) plt.yaxis_scale('log')
- d) plt.log_y()
**Answer**: a) plt.yscale('log')
- a) transparency
- b) alpha
- c) opacity
- d) blend
**Answer**: b) alpha
- a) plt.plot_contour()
- b) plt.contour()
- c) plt.line_contour()
- d) plt.fill_contour()
**Answer**: b) plt.contour()
- a) An annotation object
- b) A string
- c) A boolean value
- d) An integer
- a) plt.polar()
- b) plt.polarplot()
- c) plt.subplot(projection='polar')
- d) plt.polar_plot()
**Answer**: c) plt.subplot(projection='polar')
- a) Dashed
- b) Dotted
- c) Solid
- d) Dash-dot
**Answer**: c) Solid
18. **What does the `scatter()` function's `c` parameter specify?**
- d) Type of plot
- a) plt.hide_axes()
- b) plt.axis('off')
- c) plt.remove_axes()
- d) plt.clear_axes()
**Answer**: b) plt.axis('off')