autotitle | R Documentation |
Add a title, subtitle and caption to a spectral plot based on automatically extracted metadata from an spectral object.
autotitle(
object,
object.label = deparse(substitute(object)),
annotations = "title",
time.format = NULL,
tz = "",
default.title = "title:objt"
)
ggtitle_spct(
object,
object.label = deparse(substitute(object)),
annotations = "title",
time.format = NULL,
tz = "",
default.title = "title:objt"
)
object |
generic_spct or generic_mspct The spectral object plotted. |
object.label |
character The name of the object being plotted. |
annotations |
character vector Annotations as described for
|
time.format |
character Format as accepted by
|
tz |
character time zone used in labels. |
default.title |
character vector The default used for |
The return value of ggplot2::labs()
.
metadata retrieved from object object
is
paased to ggplot2::ggtitle()
as arguments for title
,
subtitle
and caption
. The specification for the title is
passed as argument to annotations
, and consists in the keyword
title
with optional modifiers selecting the kind of metatdata to
use, separated by colons. Up to three keywords separated by colons are
accepted, and correspond to title, subtitle and caption. The recognized
keywords are: "objt"
, "class"
, "what"
, "when"
,
"where"
, "how"
, "inst.name"
, "inst.sn"
,
"comment"
and "none"
are recognized as modifiers to
"title"
; "none"
is a placeholder. Default is
"title:objt"
or no title depending on the context.
Method renamed as autotitle()
to better reflect its function;
ggtitle_spct()
is deprecated but will remain available for backwards
compatibility.
p <- ggplot(sun.spct) +
geom_line()
p + autotitle(sun.spct)
p + autotitle(sun.spct, object.label = "The terrestrial solar spectrum")
p + autotitle(sun.spct, annotations = "title:objt:class")
p + autotitle(sun.spct, annotations = "title:where:when:how")
p <- ggplot(sun_evening.spct) +
aes(linetype = spct.idx) +
geom_line()
p + autotitle(sun_evening.spct, annotations = "title:objt:class")
p + autotitle(sun_evening.spct, annotations = "title:where:when:how")
p + autotitle(sun_evening.spct, annotations = "title:none:none:how")
p <- ggplot(sun_evening.mspct) +
aes(linetype = spct.idx) +
geom_line()
p + autotitle(sun_evening.mspct, annotations = "title:objt:class")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.