Using the fill argument on geom_bar is not coloring the bars on my plot. I'm using the train.csv from the titanic data set here.
passengers <- read.csv('../input/train.csv')
I have tried moving the fill outside of the aes(), tried moving the aes up to the ggplot() function.
This is the code I'm using on the Titanic Data set
ggplot(data = passengers) +
geom_bar(mapping = aes(x=Survived, fill = Pclass))
This is the code I'm using as a template which works fine on the ggplot built in diamonds data.
ggplot(data = diamonds) +
geom_bar(mapping = aes(x = cut, fill = cut))
I just keep getting grey bars with the geom_bar for Survived using Pclass as the fill.
passengers
, your data frame of however you've reorganized the Titanic data set. – joranas.character()
around it. – tomasu