Figure and axes, plot types, customization, subplots, seaborn statistical plots and choosing the right chart.
35 cards · basic cards · AI-written, checked twice. Edit anything.
- What is a Figure in Matplotlib?
Show answer
The overall window or page that contains plot axes, subplots, and decorative elements.
- What is an Axes object in Matplotlib?
Show answer
A single plot area with its own coordinate system, axis labels, and title.
- How do you create a Figure and Axes together?
Show answer
Use fig, ax = plt.subplots()
- What method returns the current Axes object?
Show answer
plt.gca(), which stands for get current axes.
- What function creates a line plot?
Show answer
plt.plot() or ax.plot()
- What function creates a scatter plot?
Show answer
plt.scatter() or ax.scatter()
- How do you create a bar chart?
Show answer
plt.bar() or ax.bar()
- What function creates a histogram?
Show answer
plt.hist() or ax.hist()
- What is a box plot used for?
Show answer
Displaying the distribution of data with quartiles, median, and outliers.
- How do you create a pie chart?
Show answer
plt.pie() or ax.pie()
- What function displays a 2D grid of color-coded values?
Show answer
plt.imshow() or ax.imshow()
- How do you create a contour plot?
Show answer
plt.contour() for line contours or plt.contourf() for filled contours.
- What parameter sets the x-axis label?
Show answer
Use ax.set_xlabel('text') or plt.xlabel('text')
- How do you set a plot title?
Show answer
ax.set_title('text') or plt.title('text')
- What parameter changes the line color in plt.plot()?
Show answer
The 'color' parameter, e.g., color='red', or shorthand c='r'.