geom_parallel_sets_labs | R Documentation |
This is the same function as geom_parallel_sets_labels()
from the
ggforce package but with the ability to nudge labels at a fixed
distance. It is especially useful when the labels are too long to fit
inside the bars depicting the discrete categories.
geom_parallel_sets_labs(
mapping = NULL,
data = NULL,
stat = "parallel_sets_axes",
position = "identity",
parse = FALSE,
nudge_x = 0,
nudge_y = 0,
check_overlap = FALSE,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
A string indicating the statistical transformation to use on the data for this layer. Default is "parallel_sets_axes". |
position |
Position adjustment, either as a string, or the result of
a call to a position adjustment function. Cannot be jointy specified with
|
parse |
If |
nudge_x , nudge_y |
Horizontal and vertical adjustment to nudge labels
by. Useful for offsetting text from points, particularly on discrete
scales. Cannot be jointly specified with |
check_overlap |
If |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
... |
Other arguments passed on to |
A pull request of the nudge enhancement has been submitted to the ggforce's GitHub repository, https://github.com/thomasp85/ggforce/pull/260, added in v0.3.4.
A layer
object
I-Hsuan Lin
ggforce::geom_parallel_sets_labels()
, ggplot2::layer()
library(ggforce)
data <- as.data.frame(Titanic)
data <- gather_set_data(data, 1:4)
# Use nudge_x to offset and hjust = 0 to left-justify label
ggplot(data, aes(x, id = id, split = y, value = Freq)) +
geom_parallel_sets(aes(fill = Sex), alpha = 0.3, axis.width = 0.1) +
geom_parallel_sets_axes(axis.width = 0.1) +
geom_parallel_sets_labs(colour = "red", angle = 0, nudge_x = 0.1, hjust = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.