I was wondering if there is a way to control the order my data plots in the graph.
This is a statistical review of groundwater data from wells. It is plotting the well in the order of their IDs. ie. MW1B then MW3B then MW4A.....
I would like to have it do MW1B then WES-14-4-93 then ........
My data / code is below.
library(ggplot2)
#Sets whic are detections and nondetects
MS$Detections <- ifelse(MS$D_AMMONIA==1, "Detected", "NonDetect")
#does the plot
p <- ggplot(data = MS, aes(x=Year, y=AMMONIA, col=Detections)) +
geom_point(aes(shape=Detections)) +
##sets the colors
scale_colour_manual(values=c("black","red")) +
#location of the legend
theme(legend.position=c("none")) +
#sets the line color, type and size
geom_line(colour="black", linetype="dotted", size=0.5) +
ylab("Ammonia (mg/L)") +
##Graph title
ggtitle("Lower Mudstone Ammonia Time Sereis")
## does the graph using the Well IDs as the different wells.
p + facet_grid(Well ~ .)