1. load library and data

library("lattice")    # for plotting
library("dplyr")      # for data manipulatio
library("gridExtra")  # for multiple plot
data <- read.csv("BandungData.csv", header=TRUE)

2. subsetting data by year

Here we subsetted the data using dplyr package. We used only signatures variables, which were grouped by year.:

We used the select function as the following example,

NO3_1997 <- select(data, x, y, type, year, NO3, year==1997)

to use data data frame and select columns: x, y, type, year, NO3, that collected in year 1997 only.

3. making level plot

In this section, the level plots are stored in objects before plotted together using grid.arrange() function from gridExtra package. We made total plot (all year) and yearly plot for each element to see the possible timely change.

3.1 river’s signature (NO3 and NO2)

### NO3
plotNO3 <- levelplot(NO3 ~ x*y, data=data,
          xlab="X coord", ylab="Y coord",
          main="Level plot NO3",
          col.regions=terrain.colors(100))

plotNO3_1997 <- levelplot(NO3 ~ x*y, data=NO3_1997,
          xlab="X coord", ylab="Y coord",
          main="Level plot NO3 1997",
          col.regions=terrain.colors(100))
plotNO3_1998 <- levelplot(NO3 ~ x*y, data=NO3_1998,
          xlab="X coord", ylab="Y coord",
          main="Level plot NO3 1998",
          col.regions=terrain.colors(100))
plotNO3_2007 <- levelplot(NO3 ~ x*y, data=NO3_2007,
          xlab="X coord", ylab="Y coord",
          main="Level plot NO3 2007",
          col.regions=terrain.colors(100))
plotNO3_2011 <- levelplot(NO3 ~ x*y, data=NO3_2011,
          xlab="X coord", ylab="Y coord",
          main="Level plot NO3 2011",
          col.regions=terrain.colors(100))
plotNO3_2012 <- levelplot(NO3 ~ x*y, data=NO3_2012,
          xlab="X coord", ylab="Y coord",
          main="Level plot NO3 2012",
          col.regions=terrain.colors(100))

### NO2
plotNO2 <- levelplot(NO2 ~ x*y, data=data,
          xlab="X coord", ylab="Y coord",
          main="Level plot NO2",
          col.regions=terrain.colors(100))

plotNO2_1997 <- levelplot(NO2 ~ x*y, data=NO2_1997,
          xlab="X coord", ylab="Y coord",
          main="Level plot NO2 1997",
          col.regions=terrain.colors(100))
plotNO2_1998 <- levelplot(NO2 ~ x*y, data=NO2_1998,
          xlab="X coord", ylab="Y coord",
          main="Level plot NO2 1998",
          col.regions=terrain.colors(100))
plotNO2_2007 <- levelplot(NO2 ~ x*y, data=NO2_2007,
          xlab="X coord", ylab="Y coord",
          main="Level plot NO2 2007",
          col.regions=terrain.colors(100))
plotNO2_2011 <- levelplot(NO2 ~ x*y, data=NO2_2011,
          xlab="X coord", ylab="Y coord",
          main="Level plot NO2 2011",
          col.regions=terrain.colors(100))
plotNO2_2012 <- levelplot(NO2 ~ x*y, data=NO2_2012,
          xlab="X coord", ylab="Y coord",
          main="Level plot NO2 2012",
          col.regions=terrain.colors(100))
grid.arrange(plotNO3, plotNO3_1997, plotNO3_1998,
             plotNO3_2007, plotNO3_2011, plotNO3_2012,
             ncol=2)

plot of chunk Fig_plotriversig

grid.arrange(plotNO2, plotNO2_1997, plotNO2_1998,
             plotNO2_2007, plotNO2_2011, plotNO2_2012,
             ncol=2)

plot of chunk Fig_plotriversig

3.2 groundwater’s signature (SO4 and Cl)

### SO4
plotSO4 <- levelplot(SO4 ~ x*y, data=data,
          xlab="X coord", ylab="Y coord",
          main="Level plot SO4",
          col.regions=terrain.colors(100))

plotSO4_1997 <- levelplot(SO4 ~ x*y, data=SO4_1997,
          xlab="X coord", ylab="Y coord",
          main="Level plot SO4 1997",
          col.regions=terrain.colors(100))
plotSO4_1998 <- levelplot(SO4 ~ x*y, data=SO4_1998,
          xlab="X coord", ylab="Y coord",
          main="Level plot SO4 1998",
          col.regions=terrain.colors(100))
plotSO4_2007 <- levelplot(SO4 ~ x*y, data=SO4_2007,
          xlab="X coord", ylab="Y coord",
          main="Level plot SO4 2007",
          col.regions=terrain.colors(100))
plotSO4_2011 <- levelplot(SO4 ~ x*y, data=SO4_2011,
          xlab="X coord", ylab="Y coord",
          main="Level plot SO4 2011",
          col.regions=terrain.colors(100))
plotSO4_2012 <- levelplot(SO4 ~ x*y, data=SO4_2012,
          xlab="X coord", ylab="Y coord",
          main="Level plot SO4 2012",
          col.regions=terrain.colors(100))

### Cl
plotCl <- levelplot(Cl ~ x*y, data=data,
          xlab= "X coord", ylab="Y coord",
          main= "Level plot Cl",
          col.regions=terrain.colors(100))

plotCl_1997 <- levelplot(Cl ~ x*y, data=Cl_1997,
          xlab="X coord", ylab="Y coord",
          main="Level plot Cl 1997",
          col.regions=terrain.colors(100))
plotCl_1998 <- levelplot(Cl ~ x*y, data=Cl_1998,
          xlab="X coord", ylab="Y coord",
          main="Level plot Cl 1998",
          col.regions=terrain.colors(100))
plotCl_2007 <- levelplot(Cl ~ x*y, data=Cl_2007,
          xlab="X coord", ylab="Y coord",
          main="Level plot Cl 2007",
          col.regions=terrain.colors(100))
plotCl_2011 <- levelplot(Cl ~ x*y, data=Cl_2011,
          xlab="X coord", ylab="Y coord",
          main="Level plot Cl 2011",
          col.regions=terrain.colors(100))
plotCl_2012 <- levelplot(Cl ~ x*y, data=Cl_2012,
          xlab="X coord", ylab="Y coord",
          main="Level plot Cl 2012",
          col.regions=terrain.colors(100))
grid.arrange(plotSO4, plotSO4_1997, plotSO4_1998,
             plotSO4_2007, plotSO4_2011, plotSO4_2012,
             ncol=2)

plot of chunk Fig_plotgwsig

grid.arrange(plotCl, plotCl_1997, plotCl_1998,
             plotCl_2007, plotCl_2011, plotCl_2012,
             ncol=2)

plot of chunk Fig_plotgwsig

3.3 geology signature (SiO2, Fe, Mg, and Mn)

### SiO2
plotSiO2 <- levelplot(SiO2 ~ x*y, data=data,
          xlab="X coord", ylab="Y coord",
          main="Level plot SiO2",
          col.regions= terrain.colors(100))

plotSiO2_1997 <- levelplot(SiO2 ~ x*y, data=SiO2_1997,
          xlab="X coord", ylab="Y coord",
          main="Level plot SiO2 1997",
          col.regions=terrain.colors(100))
plotSiO2_1998 <- levelplot(SiO2 ~ x*y, data=SiO2_1998,
          xlab="X coord", ylab="Y coord",
          main="Level plot SiO2 1998",
          col.regions=terrain.colors(100))
plotSiO2_2007 <- levelplot(SiO2 ~ x*y, data=SiO2_2007,
          xlab="X coord", ylab="Y coord",
          main="Level plot SiO2 2007",
          col.regions=terrain.colors(100))
plotSiO2_2011 <- levelplot(SiO2 ~ x*y, data=SiO2_2011,
          xlab="X coord", ylab="Y coord",
          main="Level plot SiO2 2011",
          col.regions=terrain.colors(100))
plotSiO2_2012 <- levelplot(SiO2 ~ x*y, data=SiO2_2012,
          xlab="X coord", ylab="Y coord",
          main="Level plot SiO2 2012",
          col.regions=terrain.colors(100))

### Fe
plotFe <- levelplot(Fe ~ x*y, data=data,
          xlab="X coord", ylab="Y coord",
          main="Level plot Fe",
          col.regions= terrain.colors(100))

plotFe_1997 <- levelplot(Fe ~ x*y, data=Fe_1997,
          xlab="X coord", ylab="Y coord",
          main="Level plot Fe 1997",
          col.regions=terrain.colors(100))
plotFe_1998 <- levelplot(Fe ~ x*y, data=Fe_1998,
          xlab="X coord", ylab="Y coord",
          main="Level plot Fe 1998",
          col.regions=terrain.colors(100))
plotFe_2007 <- levelplot(Fe ~ x*y, data=Fe_2007,
          xlab="X coord", ylab="Y coord",
          main="Level plot Fe 2007",
          col.regions=terrain.colors(100))
plotFe_2011 <- levelplot(Fe ~ x*y, data=Fe_2011,
          xlab="X coord", ylab="Y coord",
          main="Level plot Fe 2011",
          col.regions=terrain.colors(100))
plotFe_2012 <- levelplot(Fe ~ x*y, data=Fe_2012,
          xlab="X coord", ylab="Y coord",
          main="Level plot Fe 2012",
          col.regions=terrain.colors(100))

### Mg
plotMg <- levelplot(Mg ~ x*y, data=data,
          xlab="X coord", ylab="Y coord",
          main="Level plot Mg",
          col.regions= terrain.colors(100))

plotMg_1997 <- levelplot(Mg ~ x*y, data=Mg_1997,
          xlab="X coord", ylab="Y coord",
          main="Level plot Mg 1997",
          col.regions=terrain.colors(100))
plotMg_1998 <- levelplot(Mg ~ x*y, data=Mg_1998,
          xlab="X coord", ylab="Y coord",
          main="Level plot Mg 1998",
          col.regions=terrain.colors(100))
plotMg_2007 <- levelplot(Mg ~ x*y, data=Mg_2007,
          xlab="X coord", ylab="Y coord",
          main="Level plot Mg 2007",
          col.regions=terrain.colors(100))
plotMg_2011 <- levelplot(Mg ~ x*y, data=Mg_2011,
          xlab="X coord", ylab="Y coord",
          main="Level plot Mg 2011",
          col.regions=terrain.colors(100))
plotMg_2012 <- levelplot(Mg ~ x*y, data=Mg_2012,
          xlab="X coord", ylab="Y coord",
          main="Level plot Mg 2012",
          col.regions=terrain.colors(100))

### Mn
plotMn <- levelplot(Mn ~ x*y, data=data,
          xlab="X coord", ylab="Y coord",
          main="Level plot Mn",
          col.regions= terrain.colors(100))

plotMn_1997 <- levelplot(Mn ~ x*y, data=Mn_1997,
          xlab="X coord", ylab="Y coord",
          main="Level plot Mn 1997",
          col.regions=terrain.colors(100))
plotMn_1998 <- levelplot(Mn ~ x*y, data=Mn_1998,
          xlab="X coord", ylab="Y coord",
          main="Level plot Mn 1998",
          col.regions=terrain.colors(100))
plotMn_2007 <- levelplot(Mn ~ x*y, data=Mn_2007,
          xlab="X coord", ylab="Y coord",
          main="Level plot Mn 2007",
          col.regions=terrain.colors(100))
plotMn_2011 <- levelplot(Mn ~ x*y, data=Mn_2011,
          xlab="X coord", ylab="Y coord",
          main="Level plot Mn 2011",
          col.regions=terrain.colors(100))
plotMn_2012 <- levelplot(Mn ~ x*y, data=Mn_2012,
          xlab="X coord", ylab="Y coord",
          main="Level plot Mn 2012",
          col.regions=terrain.colors(100))
grid.arrange(plotSiO2, plotSiO2_1997, plotSiO2_1998,
             plotSiO2_2007, plotSiO2_2011, plotSiO2_2012,
             ncol=2)

plot of chunk Fig_plotgeologysig

grid.arrange(plotMg, plotMg_1997, plotMg_1998,
             plotMg_2007, plotMg_2011, plotMg_2012,
             ncol=2)

plot of chunk Fig_plotgeologysig

grid.arrange(plotFe, plotFe_1997, plotFe_1998,
             plotFe_2007, plotFe_2011, plotFe_2012,
             ncol=2)

plot of chunk Fig_plotgeologysig

grid.arrange(plotMn, plotMn_1997, plotMn_1998,
             plotMn_2007, plotMn_2011, plotMn_2012,
             ncol=2)

plot of chunk Fig_plotgeologysig

4. Remarks