Changing colour of bars in chart on ggplot

Hi,

How do I alter colour of bars in ggplot? I just want to make them a light grey so the error bars show up.
Here is my code:

FuncGrpPlot <- ggplot(SummFuncGrp1, aes(FuncGrp, yi)) +
geom_col() +
geom_errorbar(aes(ymin = yi - ci, ymax = yi + ci), width=0.2)

FuncGrpPlot + labs(y="Effect Size", x = "Function Group") + theme_bw()

Many thanks
Annabel

This reference page for color-related aesthetics for ggplot2 should help get you on the right path - the fill aesthetic is what you're looking for.

1 Like

Thanks Katherine. Unfortunately I am having to use the geom_errorbar function. that doesn't have a fill option. Do you have any suggestions?

many thanks
Annabel

Hm...just so I understand, if you apply fill to geom_col(), you're still unable to see the error bars? In order for me to see what you're seeing, can you please create a reprex (reproducible example)? This will ensure we're looking at the same data and code.

A guide for creating a reprex can be found here.

1 Like

Thanks so much Katherine. Using geom_col has solved that problem!!

You're quite welcome! :slight_smile: