• Stars
    star
    749
  • Rank 60,575 (Top 2 %)
  • Language
    R
  • Created almost 8 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

✨ Hexagon sticker in R

hexSticker: create hexagon sticker in R

CRAN_Status_Badge

✍️ Author

Guangchuang YU https://yulab-smu.top

School of Basic Medical Sciences, Southern Medical University

saythanks


⏬ Installation

Install the hexSticker package via CRAN:

install.packages("hexSticker")

You can also install the package via the Github repository.

# install.package("remotes")   #In case you have not installed it.
remotes::install_github("GuangchuangYu/hexSticker")

Fail to install

imageMagick

imageMagick is required for installing hexSticker. If you have not installed it, please try the following approaches.

Fail to load ‘sysfonts’

In Mac OS, you may need to re-install sysfont to properly load it.

Be sure to install xquartz first.

brew update && brew install homebrew/cask/xquartz

Examples

sticker function will produce a file with dimension exactly for printing according to http://hexb.in/sticker.html

base plot

library(hexSticker)
s <- sticker(~plot(cars, cex=.5, cex.axis=.5, mgp=c(0,.3,0), xlab="", ylab=""),
          package="hexSticker", p_size=20, s_x=.8, s_y=.6, s_width=1.4, s_height=1.2,
          filename="inst/figures/baseplot.png")

The sticker() will generate a figure specified by the filename parameter. The output of the sticker() function is a ggplot object, e.g. the s variable in the above example. Print the object, print(s), will display the image. However, the image may slightly different from the created image file since the graphic device size are different. To solve this issue, hexSticker package provides plot function to preview sticker. Try plot(s) :).

lattice

library(lattice)

counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
bwplot <- bwplot(counts ~ outcome | treatment, xlab=NULL, ylab=NULL, cex=.5,
                 scales=list(cex=.5), par.strip.text=list(cex=.5))
sticker(bwplot, package="hexSticker", p_size=20, s_x=1.05, s_y=.8, s_width=2, s_height=1.5,
        h_fill="#f9690e", h_color="#f39c12", filename="inst/figures/lattice.png")

ggplot2

library(ggplot2)

p <- ggplot(aes(x = mpg, y = wt), data = mtcars) + geom_point()
p <- p + theme_void() + theme_transparent()

sticker(p, package="hexSticker", p_size=20, s_x=1, s_y=.75, s_width=1.3, s_height=1,
        filename="inst/figures/ggplot2.png")

image file

imgurl <- system.file("figures/cat.png", package="hexSticker")
sticker(imgurl, package="hexSticker", p_size=20, s_x=1, s_y=.75, s_width=.6,
        filename="inst/figures/imgfile.png")

Google fonts

library(showtext)
## Loading Google fonts (http://www.google.com/fonts)
font_add_google("Gochi Hand", "gochi")
## Automatically use showtext to render text for future devices
showtext_auto()

## use the ggplot2 example
sticker(p, package="hexSticker", p_size=22, s_x=1, s_y=.75, s_width=1.3, s_height=1,
        p_family = "gochi", filename="inst/figures/ggplot2-google-font.png")


💖 Stickers produced by hexSticker

If you use hexSticker and want your sticker to be listed here, please feel free to edit README.Rmd, and run rmarkdown::render("README.Rmd") in R to generate README.md.

Please put stickers in alphabet order.

Stickers for software packages

Stickers for events/workshops

Stickers for fun

Stickers for organizations

Print/order stickers

Sticker designers can make their stickers available via Sticker Mule.

Related Tools

  • badger: Query information and generate badge for using in README and GitHub Pages.
  • ggimage: Supports image files and graphic objects to be visualized in ‘ggplot2’ graphic system.
  • meme: Create Meme.
  • shadowtext: Create text grob with background shadow.

More Repositories

1

nCov2019

query stats of infected coronavirus cases
R
434
star
2

badger

Badge for R Package
R
195
star
3

ggimage

🎨 Use Images in ggplot2
R
171
star
4

ggplotify

ggplot everything
R
103
star
5

biobabble

公众号:biobabble
R
73
star
6

emojifont

🍭Emoji and fontawesom in both base and ggplot2 graphics
R
67
star
7

yyplot

Guangchuang Yu's Plot Utilities
R
51
star
8

meme

create meme
R
45
star
9

cv

Guangchuang Yu's CV
HTML
45
star
10

shadowtext

shadow text for grid and ggplot2
R
37
star
11

gglayer

provide extra layers for ggplot2
R
36
star
12

enrichment4GTEx_clusterProfiler

reproduce the functional enrichment analysis presented in GTEx paper using clusterProfiler/DOSE
33
star
13

GuangchuangYu.github.io

Guangchuang's blog
HTML
25
star
14

ggtree-current-protocols

Using ggtree to Visualize Data on Tree-Like Structure
22
star
15

rvcheck

✅R/Package Version Check
R
22
star
16

chinamap

R
22
star
17

plotTree-ggtree

ggtree version of plotTree.R
R
17
star
18

statistics_notes

Y叔的统计笔记
HTML
15
star
19

dlstats

⬇️ download stats of R packages
R
14
star
20

ideogram

R
14
star
21

mlass

💥Machine Learning clASS
R
12
star
22

plotting_tree_with_data

Two methods for mapping and visualizing associated data on phylogeny using ggtree
R
12
star
23

course_bioinfo_training

R
11
star
24

base2grob

Makefile
8
star
25

software

information of my software packages
HTML
8
star
26

frog_tree

7
star
27

pathway-analysis-workshop

HTML
4
star
28

rcliutils

R
2
star
29

bitr

Biological Id TranslatoR
R
1
star
30

skleid

State Key Laboratory of Emerging Infectious Diseases
R
1
star
31

map_data

1
star
32

my_aur_repo

Shell
1
star
33

GuangchuangYu

Background information about me.
1
star
34

doseplot

Before there was enrichplot
R
1
star