I want to create a bar chart for my data set (df) and I'm using this script:
p1<-ggplot(df,aes(x=variable,y=log10(value),fill=Subject))
p1+ geom_bar(stat = "identity",position = "dodge")
The total of 'İşçi Hakları 021D' is 56,173 and the total of 'İşçi Hakları 111D' is 32,760. So how does 111D create a longer bar than 021D?
It looks like the ggplot
is not grouping in the way you'd expect- it might be easiest to manually summarize your data so that you know exactly what you're plotting:
manual_summary <- df %>%
group_by(Subject, variable) %>%
summarize(logeach = log10(sum(value)))
ggplot(manual_summary, aes(x = variable, y = logeach, fill = Subject)) +
geom_bar(stat = "identity", position = "dodge")