Giter Club home page Giter Club logo

hexsticker's Introduction

hexSticker: create hexagon sticker in R

CRAN_Status_Badge

Author

Guangchuang YU https://guangchuangyu.github.io

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("devtools")   #In case you have not installed it.
devtools::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 sysfornt to properly load it.

Be sure to install xqartz 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)
sticker(expression(plot(cars, cex=.5, cex.axis=.5, mgp=c(0,.3,0), xlab="", ylab="")),
        package="hexSticker", p_size=8, s_x=1, s_y=.8, s_width=1.2, s_height=1,
        filename="inst/figures/baseplot.png")

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=8, s_x=1.05, s_y=.75, 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=8, s_x=1, s_y=.75, s_width=1.3, s_height=1,
        filename="inst/figures/ggplot2.png")

image file

imgurl <- "http://www.belleamibengals.com/bengal_cat_2.png"
sticker(imgurl, package="hexSticker", p_size=8, 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=8, 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.

hexsticker's People

Contributors

guangchuangyu avatar wenlong-liu avatar rcorty avatar seabbs avatar ellessenne avatar shanmdphd avatar cwimpy avatar steffenmoritz avatar rrrlw avatar pdrhlik avatar juliasilge avatar strengejacke avatar cwthom avatar bohdan-khomtchouk avatar ivelasq avatar yue-jiang avatar thiyangt avatar tazinho avatar sgibb avatar brennanpincardiff avatar markhogue avatar gfinak avatar gpaux avatar dmi3kno avatar dmarcelinobr avatar cwwhitney avatar shixiangwang avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.