key_segments | R Documentation |
These functions are helper functions for working with segment data as keys in guides. They all share the goal of creating a guide key, but have different methods:
key_segment_manual()
directly uses user-provided vectors to set segments.
key_segment_map()
makes mappings from a <data.frame>
to set segments.
key_dendro()
is a specialty case for coercing dendrogram data to segments.
Be aware that setting the key alone cannot affect the scale limits, and
will give misleading results when used incorrectly!
key_segment_manual(value, oppo, value_end = value, oppo_end = oppo, ...)
key_segment_map(data, ..., .call = caller_env())
key_dendro(dendro = NULL, type = "rectangle")
value , value_end |
A vector that is interpreted to be along the scale that the guide codifies. |
oppo , oppo_end |
A vector that is interpreted to be orthogonal to the
|
... |
|
data |
A |
.call |
A call to display in messages. |
dendro |
A data structure that can be coerced to a dendrogram through
the |
type |
A string, either |
For key_segments_manual()
and key_segments_map()
, a <data.frame>
with
the <key_range>
class.
Other keys:
key_group
,
key_range
,
key_specialty
,
key_standard
# Giving vectors directly
key_segment_manual(
value = 0:1, value_end = 2:3,
oppo = 1:0, oppo_end = 3:2
)
# Taking columns of a data frame
data <- data.frame(x = 0:1, y = 1:0, xend = 2:3, yend = 3:2)
key_segment_map(data, value = x, oppo = y, value_end = xend, oppo_end = yend)
# Using dendrogram data
clust <- hclust(dist(USArrests), "ave")
key_dendro(clust)(scale_x_discrete())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.