wiggle | R Documentation |
'Wiggle' is a theme style that adds an amount of cumulative uniform noise to interpolated lines, making them wiggle a bit. The functions are used in the following way:
wiggle()
is a function factory that produces a function that is subsequently used in elements to make lines wiggle
element_rect_wiggle()
, element_line_wiggle
are
convenience wrappers around element_*_seq()
that pass down the
function generated by wiggle()
.
wiggling_geoms()
is a convenience theme setter for the
elementalist.geom_rect
and elementalist.geom_line
elements.
wiggle(amount = 3, seed = NULL)
element_line_wiggle(amount = 3, seed = NULL, ...)
element_rect_wiggle(amount = 3, seed = NULL, ...)
wiggling_geoms(
amount = 5,
fill = NULL,
colour = NULL,
linewidth = NULL,
linetype = NULL,
color = NULL,
lineend = NULL,
sides = "tlbr",
seed = NULL,
n = 50
)
amount |
A |
seed |
An |
... |
Arguments passed to |
fill |
Fill colour. |
colour , color |
Line/border colour. Color is an alias for colour. |
linewidth |
Line/border size in mm. |
linetype |
Line type. An integer (0:8), a name (blank, solid, dashed, dotted, dotdash, longdash, twodash), or a string with an even number (up to eight) of hexadecimal digits which give the lengths in consecutive positions in the string. |
lineend |
Line end Line end style (round, butt, square) |
sides |
A |
n |
An |
The amount of wiggle added to lines and rectangles is absolute. This makes it easier to make more uniform wiggles, but causes relative distortion when resizing the plot window or device.
For wiggle()
, a function
.
For element_rect_wiggle()
, an element_rect_seq
type
list.
For element_line_wiggle()
, an element_line_seq
type
list.
For wiggling_geoms
, a partial theme
object.
Other theme styles:
glow()
,
multicolour()
barplot <- ggplot(mpg, aes(class)) +
geom_bar_theme(aes(colour = class)) +
geom_line_theme(stat = "count", aes(group = -1))
# Making geoms wiggle
barplot + wiggling_geoms()
# Making only line geoms wiggle
barplot + theme(elementalist.geom_line = element_line_wiggle(10))
# Making only rect geoms wiggle
barplot + theme(elementalist.geom_rect = element_rect_wiggle(5))
# Let other theme elements wiggle
barplot + theme(
axis.line.x = element_line_wiggle(),
axis.line.y = element_line_wiggle(),
legend.background = element_rect_wiggle(colour = "grey20")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.