| stamp_circle | R Documentation |
This function adds a text annotation layer. Contribute or help document https://github.com/EvaMaeRey/ggstamp/blob/master/R/stamp_polygon.R
stamp_circle( x0 = 0, y0 = 0, n_vertices = 100, radius = 1, size = 1.5, alpha = 1, linetype = "solid", fill = "grey35", color = "black", x0y0 = NULL )
x0 |
numeric x center of shape, defaults to 0 |
y0 |
numeric y center of shape, defaults to 0 |
n_vertices |
numeric number of vertices |
radius |
a numeric value, the distance between x0 and y0 and the vertices |
size |
numeric value indicating line width, defaults to 1.5 |
alpha |
numeric between 0 and 1 indicating transparency, defaults to 1 fully opaque, zero is fully transparent |
linetype |
a string indicating linetype, "solid", "dashed", "dotted", defaults to "solid" |
fill |
a character string indicating fill color, defaults to "grey35", for other named colors check out https://evamaerey.github.io/ggplot2_grammar_guide/named_colors |
color |
a character string indicating color, defaults to "black", for other named colors check out https://evamaerey.github.io/ggplot2_grammar_guide/named_colors |
x0y0 |
dataframe indicating center of shapes, where first column is vector for x values and second column is vector for y values, defaults to NULL |
# on plot space
library(ggplot2)
ggplot(cars) +
aes(speed, dist) +
geom_point() +
stamp_circle(color = "darkred",
radius = 12)
# on a canvas
ggcanvas() +
stamp_circle(x0 = c(0, 2.5),
fill = "magenta", color = "purple") +
stamp_label(xy = pos_polygon(x0 = 0, n = 3),
label = c("hi", "hello", "bye")) +
stamp_point(color = "turquoise")
# lots of circles
ggcanvas() +
stamp_circle(color = "turquoise4", radius = 3, fill = "turquoise") +
stamp_circle(fill = "slateblue2", radius = 2) +
stamp_circle(linetype = "dashed", alpha = .5, fill = "plum2") +
stamp_circle(x0 = 1, y0 = 1.5, size = 0,
fill = "goldenrod2") +
stamp_circle(n = 50, radius = .2, size = 0) +
stamp_spoke(angle = pi * 1:7/15, radius = 2)
# some more
ggcanvas() +
stamp_circle(x0y0 = pos_wrap(n = 5, ncol = 3, height = 1.5),
radius = .55)
# venn
ggcanvas() +
stamp_circle(
x0y0 = pos_polygon(n = 3)[1,],
radius = 1.2,
alpha = .3, fill = "blue") +
stamp_circle(
x0y0 = pos_polygon(n = 3)[2,],
radius = 1.2,
alpha = .3, fill = "red") +
stamp_circle(
x0y0 = pos_polygon(n = 3)[3,],
radius = 1.2,
alpha = .3,
fill = "green") +
stamp_text(xy = pos_polygon(n = 3),
label = c("A", "B", "C")) +
stamp_text(xy = pos_polygon(n = 3,
rotation = -.166,
radius = .65),
label = c("A&B", "B&C", "A&C"),
size = 4) +
stamp_text(label = "A&B&C",
size = 2) +
theme_void_fill()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.