Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to plot data points with circle markers.
Matplotlib
import matplotlib.pyplot as plt x = [1, 2, 3] y = [4, 5, 6] plt.plot(x, y, marker=[1]) plt.show()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'x' instead of 'o' for circle markers.
✗ Incorrect
The marker 'o' draws circle markers on the data points.
2fill in blank
mediumComplete the code to plot data points with square markers.
Matplotlib
import matplotlib.pyplot as plt x = [1, 2, 3] y = [4, 5, 6] plt.plot(x, y, marker=[1]) plt.show()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'd' which is diamond, not square.
✗ Incorrect
The marker 's' draws square markers on the data points.
3fill in blank
hardFix the error in the code to plot data points with triangle up markers.
Matplotlib
import matplotlib.pyplot as plt x = [1, 2, 3] y = [4, 5, 6] plt.plot(x, y, marker=[1]) plt.show()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'v' which is triangle down, not up.
✗ Incorrect
The marker '^' draws triangle up markers on the data points.
4fill in blank
hardFill both blanks to create a plot with red diamond markers and dashed line style.
Matplotlib
import matplotlib.pyplot as plt x = [1, 2, 3] y = [4, 5, 6] plt.plot(x, y, marker=[1], linestyle=[2], color='red') plt.show()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using solid line '-' instead of dashed '--'.
✗ Incorrect
Marker 'd' is diamond, linestyle '--' is dashed line.
5fill in blank
hardFill all three blanks to create a plot with green plus markers, dotted line style, and linewidth 2.
Matplotlib
import matplotlib.pyplot as plt x = [1, 2, 3] y = [4, 5, 6] plt.plot(x, y, marker=[1], linestyle=[2], linewidth=[3], color='green') plt.show()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using solid line '-' instead of dotted ':'.
✗ Incorrect
Marker '+' draws plus signs, linestyle ':' is dotted, linewidth 2 makes line thicker.