Challenge - 5 Problems
Marker Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of marker style in matplotlib scatter plot
What is the output of this code snippet that plots points with different markers?
Matplotlib
import matplotlib.pyplot as plt x = [1, 2, 3] y = [4, 5, 6] plt.scatter(x, y, marker='^') plt.show()
Attempts:
2 left
💡 Hint
The marker parameter controls the shape of points in scatter plots.
✗ Incorrect
The marker '^' in matplotlib means triangle-up markers. So the points are shown as triangles pointing upwards.
❓ data_output
intermediate1:30remaining
Count of unique marker types in a plot
Given this code, how many unique marker types are used in the plot?
Matplotlib
import matplotlib.pyplot as plt x = [1, 2, 3, 4] y = [1, 4, 9, 16] markers = ['o', 's', '^', 'o'] for xi, yi, m in zip(x, y, markers): plt.scatter(xi, yi, marker=m) plt.show()
Attempts:
2 left
💡 Hint
Look at the list of markers and count distinct symbols.
✗ Incorrect
The markers list has 'o', 's', '^', and 'o'. The unique markers are 'o', 's', and '^', so 3 unique types.
🔧 Debug
advanced1:30remaining
Identify the error in marker usage
What error does this code raise when run?
Matplotlib
import matplotlib.pyplot as plt plt.plot([1, 2, 3], [4, 5, 6], marker='z') plt.show()
Attempts:
2 left
💡 Hint
Check if 'z' is a valid marker in matplotlib.
✗ Incorrect
The marker 'z' is not a valid marker style in matplotlib, so it raises a ValueError.
❓ visualization
advanced2:00remaining
Visual difference of marker sizes
Which option shows the plot with the largest marker size for the point at (2, 3)?
Matplotlib
import matplotlib.pyplot as plt plt.scatter([1, 2, 3], [2, 3, 4], marker='o', s=50) plt.scatter([2], [3], marker='o', s=200) plt.show()
Attempts:
2 left
💡 Hint
The 's' parameter controls marker size in scatter plots.
✗ Incorrect
The point at (2, 3) is plotted twice, once with size 50 and once with size 200, so the larger marker is at (2, 3).
🚀 Application
expert2:30remaining
Choosing markers for categorical data visualization
You want to plot three categories of data points with distinct markers for clarity. Which set of markers is best to ensure clear visual distinction?
Attempts:
2 left
💡 Hint
Use distinct shapes to differentiate categories clearly.
✗ Incorrect
Option C uses three different marker shapes, making categories visually distinct. Other options use identical or very similar markers.