| Title: | Create Hexagon Sticker in R | 
| Version: | 0.5.0 | 
| Description: | Helper functions for creating reproducible hexagon sticker purely in R. | 
| Depends: | R (≥ 3.4.0) | 
| Imports: | ggimage, ggplot2, grDevices, hexbin, rlang, showtext, stats, sysfonts, | 
| Suggests: | magick | 
| License: | Artistic-2.0 | 
| ByteCompile: | true | 
| URL: | https://github.com/GuangchuangYu/hexSticker | 
| BugReports: | https://github.com/GuangchuangYu/hexSticker/issues | 
| Encoding: | UTF-8 | 
| RoxygenNote: | 7.3.3 | 
| NeedsCompilation: | no | 
| Packaged: | 2025-09-18 03:06:29 UTC; HUAWEI | 
| Author: | Guangchuang Yu [aut, cre], Laurent Gatto [ctb], Johannes Rainer [ctb], Sebastian Gibb [ctb], Robert Corty [ctb], Thomas Neitmann [ctb] | 
| Maintainer: | Guangchuang Yu <guangchuangyu@gmail.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2025-09-18 07:00:02 UTC | 
hexSticker: Create Hexagon Sticker in R
Description
Helper functions for creating reproducible hexagon sticker purely in R.
Author(s)
Maintainer: Guangchuang Yu guangchuangyu@gmail.com
Other contributors:
- Laurent Gatto lg390@cam.ac.uk [contributor] 
- Johannes Rainer johannes.rainer@eurac.edu [contributor] 
- Sebastian Gibb mail@sebastiangibb.de [contributor] 
- Robert Corty rcorty@gmail.com [contributor] 
- Thomas Neitmann th.neitmann@gmail.com [contributor] 
See Also
Useful links:
- Report bugs at https://github.com/GuangchuangYu/hexSticker/issues 
geom_hexagon
Description
geom layer of hexagon
Usage
geom_hexagon(size = 1.2, fill = "#1881C2", color = "#87B13F")
Arguments
| size | size of border | 
| fill | color of hexagon | 
| color | color of border | 
Value
hexagon layer
Author(s)
Guangchuang Yu
geom_pkgname
Description
add package name to sticker
Usage
geom_pkgname(
  package,
  x = 1,
  y = 1.4,
  color = "#FFFFFF",
  family = "Aller_Rg",
  fontface = "plain",
  size = 8,
  ...
)
Arguments
| package | package name | 
| x | x position | 
| y | y position | 
| color | color | 
| family | font family | 
| fontface | fontface, e.g. 'plain', 'bold', 'italic' | 
| size | font size | 
| ... | addition parameters passed to geom_text() | 
Value
package name layer
Author(s)
Guangchuang Yu
geom_url
Description
add url at the lower border of the sticker
Usage
geom_url(
  url = "www.bioconductor.org",
  x = 1,
  y = 0.08,
  family = "Aller_Rg",
  size = 1.5,
  color = "black",
  angle = 30,
  hjust = 0,
  ...
)
Arguments
| url | url | 
| x | x position of url | 
| y | y position of url | 
| family | font family | 
| size | size of url | 
| color | color of url | 
| angle | angle of url, default is 30 | 
| hjust | horizontal adjustment | 
| ... | additional parameters to geom_text | 
Value
geom layer
Author(s)
Guangchuang Yu
Objects exported from other packages
Description
These objects are imported from other packages. Follow the links below to see their documentation.
- ggimage
- ggplot2
save_sticker
Description
save sticker to file
Usage
save_sticker(filename, sticker = last_plot(), ...)
Arguments
| filename | file name | 
| sticker | sticker | 
| ... | additional parameters for ggsave | 
Author(s)
Guangchuang Yu
sticker
Description
create sticker in R
Usage
sticker(
  subplot,
  s_x = 0.8,
  s_y = 0.75,
  s_width = 0.4,
  s_height = 0.5,
  package,
  p_x = 1,
  p_y = 1.4,
  p_color = "#FFFFFF",
  p_family = "Aller_Rg",
  p_fontface = "plain",
  p_size = 8,
  h_size = 1.2,
  h_fill = "#1881C2",
  h_color = "#87B13F",
  spotlight = FALSE,
  l_x = 1,
  l_y = 0.5,
  l_width = 3,
  l_height = 3,
  l_alpha = 0.4,
  url = "",
  u_x = 1,
  u_y = 0.08,
  u_color = "black",
  u_family = "Aller_Rg",
  u_size = 1.5,
  u_angle = 30,
  white_around_sticker = FALSE,
  ...,
  filename = paste0(package, ".png"),
  asp = 1,
  dpi = 300
)
Arguments
| subplot | subplot | 
| s_x | x position for subplot | 
| s_y | y position for subplot | 
| s_width | width for subplot | 
| s_height | height for subplot | 
| package | package name | 
| p_x | x position for package name | 
| p_y | y position for package name | 
| p_color | color for package name | 
| p_family | font family for package name | 
| p_fontface | fontface for package name | 
| p_size | font size for package name | 
| h_size | size for hexagon border | 
| h_fill | color to fill hexagon | 
| h_color | color for hexagon border | 
| spotlight | whether add spotlight | 
| l_x | x position for spotlight | 
| l_y | y position for spotlight | 
| l_width | width for spotlight | 
| l_height | height for spotlight | 
| l_alpha | maximum alpha for spotlight | 
| url | url at lower border | 
| u_x | x position for url | 
| u_y | y position for url | 
| u_color | color for url | 
| u_family | font family for url | 
| u_size | text size for url | 
| u_angle | angle for url | 
| white_around_sticker | default to FALSE. If set to TRUE, it puts white triangles in the corners | 
| ... | additional parameter to geom_pkgname | 
| filename | filename to save sticker | 
| asp | aspect ratio, only works if subplot is an image file | 
| dpi | plot resolution | 
Details
The extension given in filename determines the graphics device that is
used to render the sticker, e.g. filename = 'sticker.png' creates a png file
and filename = 'sticker.svg' creates a svg file. For a list of supported
graphics devices please see the documentation of ggplot2::ggsave().
Value
gg object
Author(s)
Guangchuang Yu
Examples
library(ggplot2)
p <- ggplot(aes(x = mpg, y = wt), data = mtcars) + geom_point()
p <- p + theme_void() + theme_transparent()
outfile <- tempfile(fileext=".png")
sticker(p, package="hexSticker", filename=outfile)
sticker_dev
Description
open dev for sticker
Usage
sticker_dev()
Value
new dev
Author(s)
Guangchuang Yu
theme_sticker
Description
sticker theme
Usage
theme_sticker(size = 1.2, ...)
Arguments
| size | size of hexagon border | 
| ... | additional parameters passed to theme() | 
Value
theme for sticker
Author(s)
Guangchuang Yu