Editor

Build Accessible Chart Configurations

Advanced · Write the code · from Data Visualization: Choose the Right Chart and Tell a Story

From the lesson: Data Visualization: Choose the Right Chart and Tell a Story

A chart that looks pretty but tells the wrong story is worse than no chart at all. In 1986, NASA engineers showed managers a chart arguing that cold temperatures could damage the Space Shuttle Challenger's O-ring seals. The chart was so poorly designed that the managers couldn't see the pattern.

Read the lesson

Write a function make_accessible(series_count) that returns a list of dictionaries, each with keys 'color', 'marker', and 'linestyle' for making chart lines distinguishable without relying on color alone. Use these colors in order: '#0072B2', '#E69F00', '#009E73', '#D55E00'. Use these markers: 'o', 's', '^', 'D'. Use these linestyles: '-', '--', '-.', ':'. Return configs for the first series_count series. Print each config for series_count=3.

def make_accessible(series_count):
colors = ['#0072B2', '#E69F00', '#009E73', '#D55E00']
markers = ['o', 's', '^', 'D']
linestyles = ['-', '--', '-.', ':']
# Build and return configs
pass
configs = make_accessible(3)
for c in configs:
print(c)

More Data Visualization exercises

All Python exercises · 50 practice problems · Data Science & Machine Learning quiz