Complete the code to import the matplotlib library for plotting.
import [1] as plt
We import matplotlib.pyplot as plt to create plots.
Complete the code to create a simple line plot with x and y data.
plt.plot([1], [1, 4, 9, 16]) plt.show()
The x values should be numeric and match the length of y values.
Fix the error in the code to set the color of the line to blue.
plt.plot([1, 2, 3, 4], [1, 4, 9, 16], color=[1]) plt.show()
The color parameter expects a string with the color name in quotes.
Fill both blanks to create a scatter plot with red points and label the x-axis.
plt.scatter([1, 2, 3], [4, 5, 6], color=[1]) plt.xlabel([2]) plt.show()
The scatter points color is set to red and the x-axis label is 'X Axis'.
Fill all three blanks to create a bar chart with green bars, set the title, and label the y-axis.
plt.bar(['A', 'B', 'C'], [5, 7, 3], color=[1]) plt.title([2]) plt.ylabel([3]) plt.show()
The bars are green, the chart title is 'Sales Data', and the y-axis label is 'Quantity'.
