View source: R/scale-linetype.R
scale_linetype | R Documentation |
Default line types based on a set supplied by Richard Pearson,
University of Manchester. Continuous values can not be mapped to
line types unless scale_linetype_binned()
is used. Still, as linetypes has
no inherent order, this use is not advised.
scale_linetype(name = waiver(), ..., na.value = "blank")
scale_linetype_binned(name = waiver(), ..., na.value = "blank")
scale_linetype_continuous(...)
scale_linetype_discrete(name = waiver(), ..., na.value = "blank")
name |
The name of the scale. Used as the axis or legend title. If
|
... |
Arguments passed on to
|
na.value |
The linetype to use for |
The documentation for differentiation related aesthetics.
Other linetype scales: scale_linetype_manual()
, scale_linetype_identity()
.
The line type section of the online ggplot2 book.
base <- ggplot(economics_long, aes(date, value01))
base + geom_line(aes(group = variable))
base + geom_line(aes(linetype = variable))
# See scale_manual for more flexibility
# Common line types ----------------------------
df_lines <- data.frame(
linetype = factor(
1:4,
labels = c("solid", "longdash", "dashed", "dotted")
)
)
ggplot(df_lines) +
geom_hline(aes(linetype = linetype, yintercept = 0), linewidth = 2) +
scale_linetype_identity() +
facet_grid(linetype ~ .) +
theme_void(20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.