ctd_plot | R Documentation |
Plot two-dimensional contours for CTD data by depth and distance
ctd_plot(
dat_in,
var_plo,
dep_in = NULL,
date = NULL,
date_col = "Date",
rngs_in = NULL,
num_levs = 8,
expand = 200,
span = 0.05,
chop = 0,
add = 0,
txt_scl = 1,
stt_scl = 0.7,
stt_txt = TRUE,
xrev = FALSE,
plot = TRUE,
xlab = "Channel distance (km)",
ylab = "Depth (m)",
var_lab = NULL,
var_scl = 1.5,
cols = c("tomato", "lightblue", "lightgreen", "green"),
msk_col = "grey",
cont_ext = 0.5,
ylim = NULL,
ncol = 100
)
dat_in |
ctd data along the tidal axis, as a |
var_plo |
chr string of variable to plot from |
dep_in |
depth soundings from bathymetric soundings |
date |
chr string of date to plot, only required if input data has more than one sample date |
date_col |
chr string of name of date column |
rngs_in |
output from |
num_levs |
numeric for number of contour levels |
expand |
numeric for expanding sample size of CTD points, see |
span |
numeric for smoothing factor to reduce jaggedness of depth values, passed to |
chop |
numeric for trimming the depth values |
add |
numeric for scalar to add to all depth values |
txt_scl |
numeric for scaling all text labels |
stt_scl |
numeric for scaling station labels at the top independent of other labels |
stt_txt |
logical if station labels on top are text for station names or triangles |
xrev |
logical indicating if distance values on the x-axis should be reversed |
plot |
logical if plot is returned, otherwise the interpolated data are returned |
xlab |
chr string for x-axis label |
ylab |
chr string for y-axis label |
var_lab |
optional chr string of text to include in the plot |
var_scl |
numeric for text size of |
cols |
chr string of colors for the plot |
msk_col |
chr string for color of masking depth |
cont_ext |
numeric (meters) for reducing the mask size for the interpolated contour plot, this can be useful to remove white spaces that are not covered by the masking depth but may have an effect on the gradient in the color ramp |
ylim |
numeric vector for y-axis limits, values must be negative for increasing depth |
ncol |
numeric indicating degree of smoothing for the color palette |
Raw data from the CTD are vertical profiles at unique stations. The data are linearly interpolated along each profile and between stations to create a two-dimensional plotting surface. The dat_in
data.frame must have at a minimum six columns for date (Date
), longitude (Long
), latitude (Lat
), station name (Station
), depth (Depth
, non-negative), and the variable to plot. The dep_in
data.frame (if provided) should have three columns for longitude (Long
), latitude (Latitude
), and depth (Depth
, non-negative).
The contour plot if plot = TRUE
, otherwise a three-element list with the x values as distance in km, y values as depth, and z values as the interpolated CTD variable
Hagy III, JD, Murrell, MC. 2007. Susceptibility of a northern Gulf of Mexico estuary to hypoxia: An analysis using box models. Estuarine, Coastal, and Shelf Science. 74:239-253.
# default plot
dt <- '2014-04-21'
ctd_plot(ctd, var_plo = 'Salinity', dep_in = PB_dep_pts, date = dt)
# get interpolated data
ctd_plot(ctd, var_plo = 'Salinity', dep_in = PB_dep_pts, date = dt, plot = FALSE)
# make color ramp match contour categories in legend
ctd_plot(ctd, 'Salinity', ncol = 8, date = dt)
# change colors
ctd_plot(ctd, 'Salinity', cols = c('Blue', 'Purple', 'Orange'), date = dt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.