Data Science Desktop Survival Guide
by Graham Williams |
|||||
Bar Chart Colour No Legend |
20200428
ds %>%
ggplot(aes(wind_dir_3pm, fill=wind_dir_3pm)) + geom_bar() + scale_y_continuous(labels=comma) + labs(x=vnames["wind_dir_3pm"], y="Count") + theme(legend.position="none")
Colour can add interest to a plot, though (unlike this example) it is usually good to use the colour to communicate further information about the data. Nonetheless, it adds to the attractiveness of the visualisation.
A spread of colour is added through the aesthetic
fill=
We add a ggplot2::theme() element here to remove the legend
that would be displayed by default, by indicating that the
legend.position=
|