View source: R/plot.dfunc.para.R
plot.dfunc.para | R Documentation |
Plot method for parametric line and point transect distance functions.
## S3 method for class 'dfunc.para'
plot(
x,
include.zero = FALSE,
nbins = "Sturges",
newdata = NULL,
legend = TRUE,
vertLines = TRUE,
plotBars = TRUE,
circles = FALSE,
density = -1,
angle = 45,
xlab = NULL,
ylab = NULL,
border = TRUE,
col = "grey85",
col.dfunc = NULL,
lty.dfunc = NULL,
lwd.dfunc = NULL,
...
)
x |
An estimated detection function object, normally
produced by calling |
include.zero |
Boolean value specifying whether to include 0 on the x-axis
of the plot. A value of TRUE will include 0 on the left hand end of the x-axis
regardless of the range of distances. A value of FALSE will plot only the
observation strip ( |
nbins |
Internally, this function uses |
newdata |
Data frame (similar to |
legend |
Logical scalar for whether to include a legend. If TRUE, a legend will be included on the plot detailing the covariate values used to generate the plot. |
vertLines |
Logical scalar specifying whether to plot vertical
lines at |
plotBars |
Logical scalar for whether to plot the histogram of distances behind the distance function. If FALSE, no histogram is plotted, only the distance function line(s). |
circles |
Logical scalar requesting the location of detection distances be plotted. If TRUE, open circles are plotted at predicted distance function heights associated with all detection distances. For computational simplicity, all distances are plotted for EVERY covariate class even though observed distances belong to only one covariate class. If FALSE, circles are not plotted. |
density |
If |
angle |
When |
xlab |
Label for the x-axis |
ylab |
Label for the y-axis |
border |
The color of bar borders when bars are plotted,
repeated as necessary to exceed the number of bars. A
value of NA or FALSE means no borders. If bars are shaded with lines
(i.e., |
col |
A vector of bar fill colors or line colors when bars are
drawn and |
col.dfunc |
Color of the distance function(s).
If only one distance function (one line) is being plotted,
the default color is "red".
If covariates or |
lty.dfunc |
Line type of the distance function(s).
If covariates or |
lwd.dfunc |
Line width of the distance function(s), replicated to the required length. Default is 2 for all lines. |
... |
When bars are plotted, this routine
uses |
The input distance function is returned, with two additional
components than can be used to reconstruct the plotted bars. (To
obtain values of the plotted distance functions, use predict
with type = "distances"
.)
The additional components are:
barHeights |
A vector containing the scaled bar heights drawn on the plot. |
barWidths |
A vector or scalar of the bar widths drawn on the plot, with measurement units. |
Re-plot the bars with barplot( return$barHeights,
width = return$barWidths )
.
plot.dfunc
# Example data
set.seed(87654)
x <- rnorm(1000, mean=0, sd=20)
x <- x[x >= 0]
x <- units::set_units(x, "ft")
Df <- data.frame(transectID = "A"
, distance = x
) |>
dplyr::nest_by( transectID
, .key = "detections") |>
dplyr::mutate(length = units::set_units(1,"mi"))
attr(Df, "detectionColumn") <- "detections"
attr(Df, "obsType") <- "single"
attr(Df, "transType") <- "line"
attr(Df, "effortColumn") <- "length"
is.RdistDf(Df) # TRUE
# Estimation
dfunc <- dfuncEstim(Df
, formula = distance~1
, likelihood="halfnorm")
plot(dfunc)
plot(dfunc, nbins=25)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.