Complete the code to create a subplot in a figure.
import matplotlib.pyplot as plt fig = plt.figure() ax = fig.[1](111) plt.show()
The add_subplot method adds a subplot to the figure. The code 111 means 1 row, 1 column, first subplot.
Complete the code to create a 2x2 grid of subplots and select the second subplot.
import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot([1]) plt.show()
The code 222 means 2 rows, 2 columns, and select the 2nd subplot.
Fix the error in the code to correctly add a subplot to the figure.
import matplotlib.pyplot as plt fig = plt.figure() ax = fig.[1](1, 2, 1) plt.show()
The add_subplot method accepts three separate arguments for rows, columns, and index.
Fill both blanks to create a 3x1 grid and select the second subplot.
import matplotlib.pyplot as plt fig = plt.figure() ax = fig.[1]([2]) plt.show()
Use add_subplot method with code 312 for 3 rows, 1 column, 2nd subplot.
Fill all three blanks to create a 2x3 grid and select the fourth subplot.
import matplotlib.pyplot as plt fig = plt.figure() ax = fig.[1]([2], [3], 4) plt.show()
The add_subplot method takes rows, columns, and index as separate arguments. Here, 2 rows, 3 columns, and 4th subplot.