scale_linewidth | R Documentation |
scale_linewidth
scales the width of lines and polygon strokes. Due to
historical reasons, it is also possible to control this with the size
aesthetic, but using linewidth
is encourage to clearly differentiate area
aesthetics from stroke width aesthetics.
scale_linewidth(
name = waiver(),
breaks = waiver(),
labels = waiver(),
limits = NULL,
range = c(1, 6),
transform = "identity",
trans = deprecated(),
guide = "legend"
)
scale_linewidth_binned(
name = waiver(),
breaks = waiver(),
labels = waiver(),
limits = NULL,
range = c(1, 6),
n.breaks = NULL,
nice.breaks = TRUE,
transform = "identity",
trans = deprecated(),
guide = "bins"
)
name |
The name of the scale. Used as the axis or legend title. If
|
breaks |
One of:
|
labels |
One of:
|
limits |
One of:
|
range |
a numeric vector of length 2 that specifies the minimum and maximum size of the plotting symbol after transformation. |
transform |
For continuous scales, the name of a transformation object or the object itself. Built-in transformations include "asn", "atanh", "boxcox", "date", "exp", "hms", "identity", "log", "log10", "log1p", "log2", "logit", "modulus", "probability", "probit", "pseudo_log", "reciprocal", "reverse", "sqrt" and "time". A transformation object bundles together a transform, its inverse,
and methods for generating breaks and labels. Transformation objects
are defined in the scales package, and are called |
trans |
|
guide |
A function used to create a guide or its name. See
|
n.breaks |
An integer guiding the number of major breaks. The algorithm
may choose a slightly different number to ensure nice break labels. Will
only have an effect if |
nice.breaks |
Logical. Should breaks be attempted placed at nice values
instead of exactly evenly spaced between the limits. If |
The documentation for differentiation related aesthetics.
The line width section of the online ggplot2 book.
p <- ggplot(economics, aes(date, unemploy, linewidth = uempmed)) +
geom_line(lineend = "round")
p
p + scale_linewidth("Duration of\nunemployment")
p + scale_linewidth(range = c(0, 4))
# Binning can sometimes make it easier to match the scaled data to the legend
p + scale_linewidth_binned()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.