shape aesthetics modify the appearance of
lines and/or points. They also apply to the outlines of polygons (
size) or to text (
linetype aesthetic can be specified with either an integer (0-6), a
name (0 = blank, 1 = solid, 2 = dashed, 3 = dotted, 4 = dotdash, 5 = longdash,
6 = twodash), a mapping to a discrete variable, or a string of an even number
(up to eight) of hexadecimal digits which give the lengths in consecutive
positions in the string. See examples for a hex string demonstration.
size aesthetic can be specified with a numerical value (in millimetres)
or via a mapping to a continuous variable.
shape aesthetic can be specified with an integer (between 0 and 25),
a single character (which uses that character as the plotting symbol),
. to draw the smallest rectangle that is visible (i.e., about one pixel),
NA to draw nothing, or a mapping to a discrete variable. Symbols and
filled shapes are described in the examples below.
p + geom_line(linetype = "dotdash")# An example with hex strings; the string "33" specifies three units on followed # by three off and "3313" specifies three units on followed by three off followed # by one on and finally three off. p + geom_line(linetype = "3313")# Mapping line type from a grouping variable ggplot(economics_long, aes(date, value01)) + geom_line(aes(linetype = variable))# Shape examples p + geom_point()p + geom_point(shape = 5)p + geom_point(shape = "k", size = 3)p + geom_point(shape = ".")p + geom_point(shape = NA)#> Warning: Removed 32 rows containing missing values (geom_point).# A look at all 25 symbols df2 <- data.frame(x = 1:5 , y = 1:25, z = 1:25) p <- ggplot(df2, aes(x, y)) p + geom_point(aes(shape = z), size = 4) + scale_shape_identity()# While all symbols have a foreground colour, symbols 19-25 also take a # background colour (fill) p + geom_point(aes(shape = z), size = 4, colour = "Red") + scale_shape_identity()