Basically, I have a dataset with three variables im interested in plotting. One is called subgroup which has the name of subgroups that the strains belong to. At least two of them share the same subgroup. Currently, when I bar plot them,and fill by subgroup I get coloured bars accroding to the subgroups but they dont appear next to eachother (and instead do by strain name in alphabetical order). I want a barplot that has any strain from the same subgroup together.
Heres the code:
`ggplot(data = Phylogeny_Pseudomonads_BasicGenomeData,
aes(x= Strain,
y= genome_size_in_Mb))+
aes(fill = Subgroups, y= genome_size_in_Mb, x=Strain)+
labs(title = "Genome Sizes Across Strains",
x= "Strain", y= "Genome Size in Mb")+
scale_x_discrete(guide = guide_axis(angle = 90)) +
geom_bar(position="dodge", stat="identity", width = 0.5)`
heres what I have:
enter image description here
the data set sneakpeak:
enter image description here
Sasha M is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.