Complete the code to create a scatter plot using matplotlib.
import matplotlib.pyplot as plt x = [1, 2, 3, 4] y = [10, 20, 25, 30] plt.[1](x, y) plt.show()
The scatter function creates a scatter plot by plotting points at the given x and y coordinates.
Complete the code to add labels to the x and y axes in the scatter plot.
import matplotlib.pyplot as plt x = [5, 7, 8, 7, 2] y = [99, 86, 87, 88, 100] plt.scatter(x, y) plt.xlabel([1]) plt.ylabel('Scores') plt.show()
The x-axis label should describe the data on the x-axis. Here, it is 'Age'.
Fix the error in the code to correctly plot a scatter plot with red points.
import matplotlib.pyplot as plt x = [1, 2, 3, 4] y = [10, 20, 25, 30] plt.scatter(x, y, color=[1]) plt.show()
The color argument requires a string, so it must be in quotes. 'r' is a shorthand for red color.
Fill both blanks to create a scatter plot with blue points and size 100.
import matplotlib.pyplot as plt x = [2, 4, 6, 8] y = [5, 15, 25, 35] plt.scatter(x, y, color=[1], s=[2]) plt.show()
The color is set to 'blue' as a string, and the size s is set to 100 for larger points.
Fill all three blanks to create a scatter plot with green points, size 80, and alpha transparency 0.5.
import matplotlib.pyplot as plt x = [1, 3, 5, 7] y = [2, 4, 6, 8] plt.scatter(x, y, color=[1], s=[2], alpha=[3]) plt.show()
The color is 'green' as a string, size s is 80 for medium points, and alpha 0.5 makes points semi-transparent.