Complete the code to import the library needed to create histograms.
import [1] as plt
We use matplotlib.pyplot to create histograms in Python.
Complete the code to create a histogram of the data list.
data = [1, 2, 2, 3, 3, 3, 4] plt.[1](data) plt.show()
The hist function creates a histogram from data.
Fix the error in the code to set the number of bins to 5 in the histogram.
data = [1, 2, 2, 3, 3, 3, 4] plt.hist(data, bins=[1]) plt.show()
The bins parameter expects an integer number, not a string or expression.
Fill both blanks to create a histogram with 4 bins and set the color to blue.
plt.hist(data, bins=[1], color=[2]) plt.show()
We set bins to 4 and color to 'blue' as a string to customize the histogram.
Fill all three blanks to create a histogram with 6 bins, green color, and add a title 'My Histogram'.
plt.hist(data, bins=[1], color=[2]) plt.title([3]) plt.show()
Set bins to 6, color to 'green', and title to 'My Histogram' as a string.
