Challenge - 5 Problems
Colormap Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of Sequential Colormap Gradient Plot
What will be the color of the middle bar in this horizontal bar plot using the 'Blues' sequential colormap?
Matplotlib
import matplotlib.pyplot as plt import numpy as np values = np.linspace(0, 1, 5) colors = plt.cm.Blues(values) plt.barh(range(5), [1]*5, color=colors) plt.show() # Question: What color corresponds to the middle bar (index 2) in terms of blue intensity?
Attempts:
2 left
💡 Hint
Sequential colormaps go from light to dark as values increase from 0 to 1.
✗ Incorrect
The 'Blues' colormap starts with very light blue at 0 and ends with dark blue at 1. The middle value (0.5) corresponds to a medium blue color.
🧠 Conceptual
intermediate1:30remaining
Purpose of Diverging Colormaps
Why are diverging colormaps useful in data visualization?
Attempts:
2 left
💡 Hint
Think about data that has a meaningful midpoint like zero or average.
✗ Incorrect
Diverging colormaps are designed to emphasize deviation from a midpoint, such as zero, by using two contrasting colors on either side.
❓ visualization
advanced2:30remaining
Identify Qualitative Colormap Usage
Which plot correctly uses a qualitative colormap to display categorical data?
Matplotlib
import matplotlib.pyplot as plt import numpy as np categories = ['A', 'B', 'C', 'D'] values = [5, 7, 3, 4] colors = plt.cm.Set3(np.linspace(0, 1, 4)) plt.bar(categories, values, color=colors) plt.show()
Attempts:
2 left
💡 Hint
Qualitative colormaps are best for categories without order.
✗ Incorrect
The 'Set3' colormap is qualitative and provides distinct colors for categorical data, making it ideal for bar plots with categories.
🔧 Debug
advanced2:00remaining
Error in Using Colormap for Continuous Data
What error or issue will occur with this code snippet?
Matplotlib
import matplotlib.pyplot as plt import numpy as np values = np.array([1, 2, 3, 4]) colors = plt.cm.Set3(values / 4) plt.scatter(values, values, color=colors) plt.show()
Attempts:
2 left
💡 Hint
Colormaps expect input values normalized between 0 and 1.
✗ Incorrect
Qualitative colormaps like 'Set3' expect input values between 0 and 1. Passing integers outside this range causes a ValueError.
🚀 Application
expert3:00remaining
Choosing the Best Colormap for Temperature Anomaly Data
You have temperature anomaly data ranging from -5 to +5 degrees. Which colormap choice best helps visualize both negative and positive anomalies clearly?
Attempts:
2 left
💡 Hint
Think about data with meaningful midpoint zero and two extremes.
✗ Incorrect
Diverging colormaps like 'coolwarm' highlight values below and above zero with contrasting colors, making it ideal for temperature anomalies.