| lc50_plot | R Documentation |
Plots every data set: observed points, the fitted curve of the computed
method with its pointwise confidence band, and dashed reference lines
marking the LC estimate, which is itself marked by a circle where it
lies on the fitted curve. By default the concentration axis is on a
log10 scale, which gives the classical symmetric S-shaped curve;
shape = "linear" restores the original linear axis.
lc50_plot(
results,
save_path = NULL,
font = "TNM",
width = 7,
height = 6,
dpi = 300,
unit = NULL,
shape = c("sigmoid", "linear"),
ci = TRUE,
ci_level = 0.95,
error_bar = TRUE,
move_thres = 0.5,
method = NULL,
lc_ci = TRUE,
lc_p = TRUE,
lc_lab_gap = 0.35,
lc_lab_gap_right = 0.1,
lc_lab_dy = 0.1,
lc_lab_lh = 1.05
)
results |
Result list of |
save_path |
Folder for the png files; |
font |
Font family (default |
width, height |
Figure size in inches (default 7 x 6). |
dpi |
Resolution of the saved files (default 300); at any dpi the figures keep the physical size they have at 300 dpi. |
unit |
Unit of the concentration (e.g. |
shape |
|
ci |
Logical (default |
ci_level |
Confidence level of the curve band and of the replicate error bars (default 0.95). |
error_bar |
Logical (default |
move_thres |
Numeric (default 0.5). A dashed reference line that
does not land on a regular tick normally gets an extra tick whose
value is labelled next to the axis like a regular tick. If the LC
position is at most |
method |
Character scalar, which methods to plot: a subset of
|
lc_ci |
Logical (default |
lc_p |
Logical (default |
lc_lab_gap |
Clearance between the vertical reference line and the near edge of the LC label when the label sits LEFT of the line, in text widths of the label itself (default 0.35). Larger pushes the label further away from the line; smaller moves it towards it. |
lc_lab_gap_right |
The same clearance when the label sits RIGHT
of the line (default 0.1, smaller than |
lc_lab_dy |
Clearance between the LC label block and the LC
crossing, in y-axis units (default 0.1): the distance from the
crossing to the edge of the block that faces it. The block is
placed in the diagonal quadrant the fitted curve never enters
(above the crossing when the label sits left of the vertical
reference line, below it when the label sits right), anchored by
that facing edge, so adding lines or changing |
lc_lab_lh |
Line spacing of the LC label in multiples of its
font size (1 = single spacing, default 1.05). The lines are spaced
evenly whichever of them |
Replicates of the same concentration are pooled and drawn as
the Abbott-corrected pooled mortality with Wilson score intervals.
The LC reference label is centred around the crossing of the two
dashed reference lines. Because the sigmoid only ever passes
through the lower-left and upper-right quadrants around that
crossing, the label is placed in one of the two free ones: above
the crossing when it sits left of the vertical reference line,
below it when it sits right, at a clearance of lc_lab_dy.
If a replicate error bar reaches into the label block, the block is
shifted vertically by the smallest amount that restores a clearance
of about one line height from the bar end, preferring the direction
that keeps it on its own side of the crossing. The extra x-axis
value always sits to the right of the vertical dashed line (it
moves to the left only when it would run off the right panel
edge); when the label block dips into the value's strip, the block
is raised clear of it instead.
Named list of ggplot objects (invisibly).
Saved files are named after the data set plus suffixes for every
non-default setting that changes the look (_linear for
shape = "linear", _noband for ci = FALSE,
_nobar for error_bar = FALSE, _nolcCI for
lc_ci = FALSE, _nochi for lc_p = FALSE, and the
selected method names), so plots saved to one folder can never
overwrite each other.
lc50_export, lc50_export_plot
f <- system.file("extdata", "lc50_example.csv", package = "insectecol")
res <- lc50_calculate(lc50_read(f))
plots <- lc50_plot(res, save_path = tempdir())
plots <- lc50_plot(res, shape = "linear", save_path = tempdir()) # original axis
plots <- lc50_plot(res, ci = FALSE, error_bar = FALSE,
save_path = tempdir()) # bare version
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.