Challenge - 5 Problems
Scatter Plot Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate1:30remaining
Scatter plot point count
What is the number of points plotted by this code?
Data Analysis Python
import matplotlib.pyplot as plt import numpy as np x = np.arange(10) y = x**2 plt.scatter(x, y) plt.show() print(len(x))
Attempts:
2 left
💡 Hint
Count how many elements are in the x array.
✗ Incorrect
The array x has 10 elements from 0 to 9, so 10 points are plotted.
❓ data_output
intermediate2:00remaining
Scatter plot color array length
What happens if the color array length does not match the number of points in this scatter plot?
Data Analysis Python
import matplotlib.pyplot as plt import numpy as np x = np.arange(5) y = x * 2 colors = ['red', 'blue'] plt.scatter(x, y, c=colors) plt.show()
Attempts:
2 left
💡 Hint
Check if matplotlib requires color array length to match points.
✗ Incorrect
Matplotlib requires the color array length to match the number of points. If not, it raises a ValueError.
❓ visualization
advanced2:30remaining
Scatter plot with size and color mapping
Which option produces a scatter plot where point size and color both vary with data?
Data Analysis Python
import matplotlib.pyplot as plt import numpy as np x = np.random.rand(50) y = np.random.rand(50) sizes = 100 * x colors = y plt.scatter(x, y, s=sizes, c=colors, cmap='viridis') plt.colorbar() plt.show()
Attempts:
2 left
💡 Hint
Check which variables control size and color in plt.scatter.
✗ Incorrect
The code sets s=sizes where sizes = 100 * x, so size depends on x. Color c=colors is y, so color depends on y. Colorbar is shown.
🔧 Debug
advanced1:30remaining
Identify error in scatter plot code
What error does this code raise?
Data Analysis Python
import matplotlib.pyplot as plt x = [1, 2, 3] y = [4, 5] plt.scatter(x, y) plt.show()
Attempts:
2 left
💡 Hint
Check if x and y have the same length.
✗ Incorrect
x has 3 elements, y has 2. Matplotlib requires equal length arrays for scatter plot, so it raises ValueError.
🚀 Application
expert3:00remaining
Interpreting scatter plot clustering
You have a scatter plot showing two clear clusters of points. What is the best data science interpretation?
Attempts:
2 left
💡 Hint
Clusters in scatter plots usually indicate groups.
✗ Incorrect
Clusters in scatter plots suggest the data points form distinct groups or categories.