Complete the code to import the library used for creating visualizations.
import [1] as plt
The matplotlib.pyplot module is commonly imported as plt for plotting graphs in Python.
Complete the code to create a simple line plot of the data list.
data = [1, 3, 2, 5] plt.[1](data) plt.show()
The plot function creates a line plot, which is suitable for showing trends in data.
Fix the error in the code to label the x-axis correctly.
plt.plot([1, 2, 3], [4, 5, 6]) plt.xlabel([1]) plt.show()
The label text must be a string, so it needs to be enclosed in quotes.
Fill both blanks to create a bar chart with labels and title.
plt.bar(['A', 'B', 'C'], [5, 7, 3]) plt.xlabel([1]) plt.title([2]) plt.show()
The x-axis label should describe the categories, and the title should summarize the chart's message.
Fill all three blanks to create a scatter plot with axis labels and a title.
x = [1, 2, 3, 4] y = [10, 15, 13, 17] plt.scatter(x, y) plt.xlabel([1]) plt.ylabel([2]) plt.title([3]) plt.show()
The x-axis label describes the independent variable (time), the y-axis label describes the dependent variable (speed), and the title summarizes the plot.