plot(env$dfs, env$dis,
type = "l",
xlab = "Distance from the source (km)",
ylab = "Discharge (m3/s)",
col = "blue",
main = "Discharge"
)
plot(env$dfs, env$oxy,
type = "l",
xlab = "Distance from the source (km)",
ylab = "Oxygen (mg/L)",
col = "green3",
main = "Oxygen"
)
plot(env$dfs, env$nit,
type = "l",
xlab = "Distance from the source (km)",
ylab = "Nitrate (mg/L)",
col = "brown",
main = "Nitrate"
)
To explore graphically the bivariate relationships among the environmental variables, we can use the powerful pairs() graphical function, which draws a matrix
of scatter plots (Fig. 2.9).
Moreover, we can add a LOWESS smoother to each bivariate plot and draw
histograms in the diagonal plots, showing the frequency distribution of each variable, using external functions found in the panelutils.R script.
## Scatter plots for all pairs of environmental variables
# Bivariate plots with histograms on the diagonal and smooth
# fitted curves
pairs(env,
panel = panel.smooth,
diag.panel = panel.hist,
main = "Bivariate Plots with Histograms and Smooth Curves"
)
Hint Each scatterplot shows the relationship between two variables identified on the
main diagonal. The abscissa of the scatterplot is the variable above or under it,
and the ordinate is the variable to its left or right.
2.2 Data Exploration
31
type = "l",
xlab = "Distance from the source (km)",
ylab = "Discharge (m3/s)",
col = "blue",
main = "Discharge"
)
plot(env$dfs, env$oxy,
type = "l",
xlab = "Distance from the source (km)",
ylab = "Oxygen (mg/L)",
col = "green3",
main = "Oxygen"
)
plot(env$dfs, env$nit,
type = "l",
xlab = "Distance from the source (km)",
ylab = "Nitrate (mg/L)",
col = "brown",
main = "Nitrate"
)
To explore graphically the bivariate relationships among the environmental variables, we can use the powerful pairs() graphical function, which draws a matrix
of scatter plots (Fig. 2.9).
Moreover, we can add a LOWESS smoother to each bivariate plot and draw
histograms in the diagonal plots, showing the frequency distribution of each variable, using external functions found in the panelutils.R script.
## Scatter plots for all pairs of environmental variables
# Bivariate plots with histograms on the diagonal and smooth
# fitted curves
pairs(env,
panel = panel.smooth,
diag.panel = panel.hist,
main = "Bivariate Plots with Histograms and Smooth Curves"
)
Hint Each scatterplot shows the relationship between two variables identified on the
main diagonal. The abscissa of the scatterplot is the variable above or under it,
and the ordinate is the variable to its left or right.
2.2 Data Exploration
31
