Hi guys,
I am wondering if there is a way to plot a bar indicating the distribution and the cutoff value like below.
pic from Biden vs Trump: US presidential election 2020 results
I have got
attitude <- c('solid_blue', 'leaning_blue', 'toss_up', 'leaning_red', 'solid_red')
n_votes <- c(190, 108, 121, 39, 80)
group <- c(1,1,1,1,1)
df <- rbind(attitude, n_votes, group)
df <- as.data.frame(t(df))
ggplot(data = df) +
geom_bar(stat = 'identity', mapping = aes (x = group, y = n_votes, fill = attitude)) + coord_flip()
The n_votes does not seem to accumulate correctly, how can I correct this?
Cheers,
Danny