key_standard | R Documentation |
These functions are helper functions for working with tick marks as keys in guides. They all share the goal of creating a guide key, but have different outcomes:
key_auto()
is a function factory whose functions extract a typical
key from major breaks in a scale.
key_manual()
uses user-provided vectors to make a key.
key_map()
makes mappings from a <data.frame>
to make a key.
key_minor()
is a function factory whose functions also extract minor
break positions for minor tick marks.
key_log()
is a function factory whose functions place ticks at intervals
in log10 space.
key_none()
makes an empty key with no entries.
key_auto(...)
key_manual(
aesthetic,
value = aesthetic,
label = as.character(value),
type = NULL,
...
)
key_map(data, ..., .call = caller_env())
key_minor(...)
key_log(
prescale_base = NULL,
negative_small = 0.1,
expanded = TRUE,
labeller = NULL,
...
)
key_none()
... |
|
aesthetic , value |
A vector of values for the guide to represent
equivalent to the |
label |
A |
type |
A |
data |
A |
.call |
A call to display in messages. |
prescale_base |
A |
negative_small |
A |
expanded |
A |
labeller |
A |
For key_auto()
, key_minor()
and key_log()
a function. For
key_manual()
and key_map()
a <data.frame>
with the <key_standard>
class.
Other keys:
key_group
,
key_range
,
key_segments
,
key_specialty
# An example scale
template <- scale_x_continuous(limits = c(0, 10))
# The auto, minor and log keys operate on scales
key_auto()(template)
key_minor()(template)
# So does the log key
template <- scale_x_continuous(transform = "log10", limits = c(0.1, 10))
key_log()(template)
# Providing custom values
key_manual(
aesthetic = 1:5,
label = c("one", "two", "three", "four", "five")
)
# Values from a `<data.frame>`
key_map(ToothGrowth, aesthetic = unique(supp))
# Empty key
key_none()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.