Home

Awesome

<!-- README.md is generated from README.Rmd. Please edit that file -->

ggqr

<!-- badges: start -->

<!-- badges: end -->

ggqr provides geom_qr() for inserting QR Codes into a plot.

The core QR functionality is provided by Bob Rudis’s qrencoder package.

What’s in the box

Future Possibilities?

Installation

You can install from GitHub with:

# install.package('remotes')
remotes::install_github('coolbutuseless/ggqr')

Example

library(ggplot2)
library(ggqr)

plot_df       <- head(mtcars)
plot_df$car   <- paste0("https://duckduckgo.com/?q=", rownames(plot_df))
plot_df$hjust <- c(-0.1, 1.1, 1.1, -0.1,   0,   0)
plot_df$vjust <- c( 1.1, 0.0, 0.0, -0.1, 1.1, 1.1)

ggplot(plot_df) +
  geom_qr(
    aes(
      x     = mpg, 
      y     = wt, 
      label = car, 
      hjust = I(hjust), 
      vjust = I(vjust), 
      col   = as.factor(cyl)
    ), 
    size = 0.8
  ) +
  geom_point(aes(mpg, wt), size = 3) +
  theme_bw() + 
  theme(legend.position = 'bottom') +
  labs(title = "ggqr::geom_qr() - QR codes with search links to car names")
<img src="man/figures/README-example-1.png" width="100%" />

Related Software

Acknowledgements