I have 5 datasets, each with a value column and a group column.
Each dataset has a different 'group' value. They're joined together to make 1 big dataset, each clearly separated by its 'group' value
I'm trying to create a dotplot that neatly separates the groups by themselves, kind of like the following, where the M and F groups are clearly separated:
What I currently have, however, is the following:
Since most of the datapoints sit around the 2-3 range, they are stacked above each other and the resulting plot has datapoints that are overflowing to the other groups
This is the plotting code I'm currently using:
p<-ggplot(new_df, aes(x=group, y=ploidy)) +
geom_dotplot(binaxis='y', stackdir='centerwhole', binwidth = 0.5, position = "dodge", stackgroups = TRUE, dotsize = 0.2)
ggplot(new_df, aes(x=group, y=ploidy)) +
geom_dotplot(binaxis='y', stackdir='centerwhole',
stackratio=1.5, dotsize=0.2, stackgroups = TRUE)
p + scale_x_discrete(limits=c("1", "2", "3", "4", "5"))
p + stat_summary(fun=median, geom="point", shape=18,
size=3, color="red")
Can anyone help point out what mistake I'm making and how to fix it? I've tried tweaking many different parameters and following the documentation but R isn't my main language and I'm running into trouble. Any help would be appreciated, thank you.