I want to create a group of graphs using RStudio and want the scales to be consistent between all graphs. The graphs were created with the ggplot2 package and the geom_dotplot function. For the x-axis, the values were converted to factors. In the first graph, levels 0-6 are available, but in the second graph (subpopulation of the first group), only groups 1-6 occured in the dataframe (thus, level "0" is not shown). As a result, the scaling of the X-axis of both graphs is not uniform.
I have already tried different approaches to force RStudio to show all levels. Among others I tried the following:
scale_x_discrete(drop=FALSE, limits=c("0", "6"), breaks=c("0", "1", "2", "3", "4", "5", "6"))
However, it didn't work...
Do you have an idea how to solve this issue?
Thanks in advance!