View source: R/lifetable_plot.R
| lifeTable_plot | R Documentation |
Draws the age-stage survival rate s(x,j) of every developmental stage (including the female and male adults) against age in days, in the style of the classical TWOSEX-MSChart plots.
lifeTable_plot(
lt,
sxj = NULL,
title = NULL,
x_title = "Age(days)",
y_title = "Age-Stage Survival Rate(Sxj)",
legend_labels = NULL,
dpi = 300
)
lt |
A |
sxj |
Optional; the result of |
title |
Character; plot title. Defaults to the name of the csv file. |
x_title |
Character; x axis title (default |
y_title |
Character; y axis title (default
|
legend_labels |
Character vector; legend labels, one per stage
(immature stages plus |
dpi |
Numeric; resolution (default 300). Only influences the scaling of the graphical elements (title, axis labels, legend), so that the plot looks identical at 300 and 600 dpi. |
To keep the figure clean, each stage is drawn only over the age window in which it actually occurs (extended by two days on both sides). Immature stages are drawn as coloured dots connected by a thin line; females are grey and males black, both with diamond points. By default all text of the figure is in English; title, axis titles and legend labels can be customised.
The text sizes are calibrated for being drawn while 'showtext' is
active at its default internal dpi (96); lifeTable_export
takes care of this when exporting. If you save the plot yourself,
switch 'showtext' on around the ggsave call,
otherwise the text comes out about 300/96 times too large.
A ggplot object that can be customised further or saved with
ggsave.
calc_sxj, lifeTable_export
f <- system.file("extdata", "lifetable_example.csv", package = "insectecol")
p <- lifeTable_plot(lifeTable_read(f))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.