Complete the code to create a box plot of the data list using matplotlib.
import matplotlib.pyplot as plt data = [7, 8, 5, 6, 9, 10, 4] plt.[1](data) plt.show()
The plt.boxplot() function creates a box plot for the given data.
Complete the code to add a title 'My Box Plot' to the plot.
import matplotlib.pyplot as plt data = [3, 5, 7, 9, 11] plt.boxplot(data) plt.[1]('My Box Plot') plt.show()
The plt.title() function adds a title to the plot.
Fix the error in the code to correctly display the box plot for multiple data sets.
import matplotlib.pyplot as plt data1 = [1, 2, 3, 4, 5] data2 = [2, 3, 4, 5, 6] plt.boxplot([1]) plt.show()
To plot multiple data sets in one box plot, pass a list of lists: [data1, data2].
Fill both blanks to create a box plot with custom labels for two data sets.
import matplotlib.pyplot as plt data1 = [10, 20, 30] data2 = [15, 25, 35] plt.boxplot([data1, data2], labels=[1]) plt.[2]('Custom Box Plot') plt.show()
The labels parameter sets the box labels. Use plt.title() to add a title.
Fill all three blanks to create a box plot with notch style, custom labels, and a y-axis label.
import matplotlib.pyplot as plt data1 = [5, 7, 9] data2 = [6, 8, 10] plt.boxplot([data1, data2], [1]=True, labels=[2]) plt.[3]('Values') plt.show()
Use notch=True for notch style, labels for box labels, and plt.ylabel() to label the y-axis.
