I am trying to compare two sets of data for multiple locations on an individual chart for each location.. data has structure
gw <- well.id date benzene bgs
bgs is depth to water (below ground surface) in feet. (I want to reverse this axis) benzene ranges from 3 to 9 in some wells, and from .0001 to .01 in others....
I want to plot benzene concentrations so they overlap with depth to water for a visual correlation between the two data sets...
please see this excel example plot:
here you can find the data
aspects i have in mind are one data in reverse axis, scaled y values unique to each well location and data set... and the ability to pull subsets of the plots (like only the wells that show a correlations change in the most recent year)
I am approaching it like so...
setwd("~/my_ws")
gw <- read.csv("gw_cbp.csv")
gw
library(ggplot2) # Load the library
p <- ggplot(gw, aes(x=Date, y=Benzene)) + # Tell ggplot what you're plotting
geom_point() + #Tell ggplot it's a scatter plot
geom_line() + # and i want lines
facet_wrap(~ Well.ID) + # Plot one chart for each ID
facet_grid(Date ~ Benzene, scales="free_y") ##not working... i know my syntax is wrong, just not sure how to fix it...
p +
aes(x = Date, y = bgs)+
scale_y_reverse( y = bgs) # Reverse the axis
facet_grid(Date ~ bgs, scales="free_y") ## still not working..
I know I am trying to scale my y axes individually, both unique to each location(well.id) and data set (benzene and bgs) and only one in reverse (bgs) as well as put the second y axis on the other side of the chart...but I am not getting it right.
as always, any help would be great,
ZR