I'm trying to understand, why my graph shows appropriately when scale_fill_identity is used ?
ggplot(data = result, aes(x = date, y = diffinPercentages)) geom_col( aes(fill= cond)) scale_fill_identity()
If I leave out scale_fill_identity, then the graph does not show custom colors. Instead, ggplot makes up color of its own
ggplot(data = result, aes(x = date, y = diffinPercentages)) geom_col( aes(fill= cond))
What does scale_fill_identify do to make sure custom colors are properly shown?
CodePudding user response:
The scale_fill_...
functions determine the scale used for the fill aesthetic, which would be the color used. If you don't include it, it uses the default ggplot color scale.
By providing a scale_fill_...
function, you replace the default color scale with one of your choice –