Challenge - 5 Problems
Color Visualization Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate1:30remaining
What color will the bars be in this plot?
Look at the code below that creates a bar chart. What color will the bars appear?
Matplotlib
import matplotlib.pyplot as plt values = [5, 7, 3] labels = ['A', 'B', 'C'] plt.bar(labels, values, color='skyblue') plt.show()
Attempts:
2 left
💡 Hint
Check the 'color' parameter in plt.bar function.
✗ Incorrect
The color parameter is set to 'skyblue', so the bars will appear in that color.
❓ data_output
intermediate1:30remaining
How many unique colors are used in this scatter plot?
This code plots points with different colors. How many unique colors are shown?
Matplotlib
import matplotlib.pyplot as plt x = [1, 2, 3, 4] y = [10, 15, 13, 17] colors = ['red', 'blue', 'red', 'green'] plt.scatter(x, y, c=colors) plt.show() unique_colors = len(set(colors)) print(unique_colors)
Attempts:
2 left
💡 Hint
Count the different color names in the list.
✗ Incorrect
The colors list has 'red', 'blue', 'red', and 'green'. Unique colors are red, blue, green = 3.
❓ visualization
advanced2:00remaining
Which color map best shows data intensity clearly?
You want to show data intensity from low to high using color. Which color map is best for clear understanding?
Matplotlib
import matplotlib.pyplot as plt import numpy as np np.random.seed(0) data = np.random.rand(10,10) plt.imshow(data, cmap='viridis') plt.colorbar() plt.show()
Attempts:
2 left
💡 Hint
Think about color maps that are easy to interpret for all viewers.
✗ Incorrect
Viridis is designed to be perceptually uniform and accessible, making it best for intensity visualization.
🧠 Conceptual
advanced1:30remaining
Why is choosing colorblind-friendly palettes important?
Why should we use colorblind-friendly palettes in data visualization?
Attempts:
2 left
💡 Hint
Think about accessibility and inclusivity.
✗ Incorrect
Colorblind-friendly palettes help people with color vision deficiencies understand the visualization.
🔧 Debug
expert1:30remaining
What error does this code raise related to color usage?
This code tries to plot a line with an invalid color. What error will it raise?
Matplotlib
import matplotlib.pyplot as plt plt.plot([1, 2, 3], [4, 5, 6], color='notacolor') plt.show()
Attempts:
2 left
💡 Hint
Check matplotlib's error messages for invalid colors.
✗ Incorrect
Matplotlib raises a ValueError when the color string is not recognized.