0
0
Matplotlibdata~5 mins

Axes creation with add_subplot in Matplotlib - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the add_subplot method do in matplotlib?
It adds a new set of axes (a subplot) to a figure, allowing you to create multiple plots in one figure.
Click to reveal answer
beginner
How do you specify the position of a subplot using add_subplot?
You specify the number of rows, columns, and the index of the subplot in the grid, for example add_subplot(2, 3, 4) creates a subplot in the 2x3 grid at position 4.
Click to reveal answer
beginner
What is the difference between add_subplot(111) and add_subplot(1,1,1)?
Both create a single subplot that fills the entire figure. 111 is a shorthand for 1 row, 1 column, 1st subplot.
Click to reveal answer
intermediate
Can add_subplot be used to create 3D plots?
Yes, by passing projection='3d' as an argument, you can create 3D axes with add_subplot.
Click to reveal answer
beginner
What type of object does add_subplot return?
It returns an Axes object, which you can use to plot data and customize the subplot.
Click to reveal answer
What does fig.add_subplot(2, 2, 3) do?
AAdds a subplot in a 2x2 grid at position 3
BAdds three subplots in one figure
CCreates a figure with 3 rows and 2 columns
DRemoves the third subplot from the figure
Which argument enables 3D plotting in add_subplot?
Astyle='3d'
Btype='3d'
Cmode='3d'
Dprojection='3d'
What does add_subplot(111) mean?
AInvalid syntax
B1 row, 1 column, 11th subplot
C1 row, 1 column, 1st subplot
D11 rows, 1 column, 1st subplot
What type of object do you get from add_subplot?
APlot object
BAxes object
CFigure object
DDataFrame object
If you want 6 subplots arranged in 2 rows and 3 columns, which call is correct?
Aadd_subplot(2, 3, 6)
Badd_subplot(3, 2, 6)
Cadd_subplot(6, 1, 2)
Dadd_subplot(1, 6, 2)
Explain how to create multiple subplots in one figure using add_subplot.
Think about how you divide the figure space and select the position.
You got /4 concepts.
    Describe how to create a 3D plot using add_subplot.
    Remember the special argument for 3D.
    You got /3 concepts.