How do I re-plot the below geom_col where Group 1 and Group 2 have one thick bar each, rather than multiple thin bars that all show exactly the same result?
This is the data I am plotting:
structure(list(mean_group = c(0.263699696150573, 0.255161746412958,
0.263699696150573, 0.255161746412958, 0.263699696150573, 0.255161746412958,
0.263699696150573, 0.255161746412958, 0.263699696150573, 0.255161746412958,
0.263699696150573, 0.255161746412958, 0.255161746412958, 0.263699696150573,
0.263699696150573, 0.263699696150573, 0.263699696150573), mean_sample = c(0.304449388830337,
0.304449388830337, 0.270879368594138, 0.270879368594138, 0.233636248731973,
0.233636248731973, 0.234536475984982, 0.234536475984982, 0.250903685479549,
0.250903685479549, 0.263039371741738, 0.263039371741738, 0.227068796332047,
0.227068796332047, 0.280737487680756, 0.272906770129839, 0.477592456931195
), Group = c("2", "1", "2", "1", "2", "1", "2", "1", "2", "1",
"2", "1", "1", "2", "2", "2", "2"), sample = c(1, 1, 2, 2, 3,
3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 10)), class = c("tbl_df", "tbl",
"data.frame"), row.names = c(NA, -17L))
This is my current code for plotting:
p = ggplot(exp) +
geom_col(aes(x=Group, y=mean_group), position = position_dodge2(width = 0, preserve = "single")) +
geom_dotplot(binaxis='y', stackdir='center', stackgroups = TRUE, binpositions="all", dotsize=0.8,
colour="Black", fill="Black", aes(x=Group, y = mean_sample))
p