5 Common Data Visualization Mistakes | by William Chon | Dec, 2020
If your legend takes up a lot of room, it’s a sign that you’re using too many categories. Think of ways to reduce the number of categories so that your legend contains 10 items at most. This might involve grouping categories into an “other” bucket, or coming up with another way of categorizing/displaying categories.
In the visualization below, it’s impossible to match each dot with its corresponding color — different categories becomes a waste of space.
ggplot(aes(x = mpg, y = hp, color = rownames(.))) +
labs(title = 'Comparison of Miles Per Gallon vs. Horsepower for 32 cars',
x = 'Miles Per Gallon',
y = 'Horsepower',
color = 'Car') +
theme_bw(base_size = 20)
Read More …