GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - R-CoderDotCom/ggcats: The geom you always wished for adding cats to ggplot2

BranchesTags
Open more actions menu

Latest commit

 

History

14 Commits
14 Commits

Folders and files

NameName
Last commit message
Last commit date
R
R
 
 
inst
inst
 
 
man
man
 
 
DESCRIPTION
DESCRIPTION
 
 
LICENSE
LICENSE
 
 
LICENSE.md
LICENSE.md
 
 
NAMESPACE
NAMESPACE
 
 
README.md
README.md
 
 

Repository files navigation

ggcats

The geom you always wished for adding cats to ggplot2. This package is part of the memeverse. The source code of this package is based on geom_image from ggimage.

  • Follow me on Twitter
  • Follow me on Facebook
  • Visit my R programming site

What is the memeverse?

A collection of funny packages which can be interesting to create plots to show on a first lesson to new R students in order to motivate them learning the language. The other package of the (small) memeverse are ggdogs and ggbernie. Statistics and programming can be fun!

Installation

# install.packages("remotes")
remotes::install_github("R-CoderDotCom/ggcats@main")

Available cats

There are 15 cats available:

"nyancat" (default), "bongo", "colonel", "grumpy", "hipster", "lil_bub", "maru",
"mouth", "pop", "pop_close", "pusheen", "pusheen_pc", "toast", "venus" and "shironeko"

Some examples

grid <- expand.grid(1:5, 3:1)

df <- data.frame(x = grid[, 1],
                 y = grid[, 2],
                 image = c("nyancat", "bongo", "colonel", "grumpy", "hipster",
                           "lil_bub", "maru", "mouth", "pop", "pop_close", 
                           "pusheen", "pusheen_pc", "toast", "venus", "shironeko"))
                           
library(ggplot2)
ggplot(df) +
 geom_cat(aes(x, y, cat = image), size = 5) +
    xlim(c(0.25, 5.5)) + 
    ylim(c(0.25, 3.5))

ggplot(mtcars) +
  geom_cat(aes(mpg, wt), cat = "nyancat", size = 5)

ggplot(mtcars) +
  geom_cat(aes(mpg, wt, size = cyl), cat = "toast")

I took the most part of the following code from Jonathan Hersh.

library(Ecdat)
data(incomeInequality)

library(tidyverse)
library(ggcats)
library(gganimate)


 dat <-
   incomeInequality %>%
   select(Year, P99, median) %>%
   rename(income_median = median,
          income_99percent = P99) %>%
   pivot_longer(cols = starts_with("income"),
                names_to = "income",
                names_prefix = "income_")

dat$cat <- rep(NA, 132)

dat$cat[which(dat$income == "median")] <- "nyancat"
dat$cat[which(dat$income == "99percent")] <- rep(c("pop_close", "pop"), 33)

ggplot(dat, aes(x = Year, y = value, group = income, color = income)) +
   geom_line(size = 2) +
   ggtitle("ggcats, a core package of the memeverse") +
   geom_cat(aes(cat = cat), size = 5) +
   xlab("Cats") +
   ylab("Cats") +
   theme(legend.position = "none",
         plot.title = element_text(size = 20),
         axis.text = element_blank(),
         axis.ticks = element_blank()) +
   transition_reveal(Year)

About

The geom you always wished for adding cats to ggplot2

r-charts.com/miscellaneous/ggcats/

Topics

ggplot-extensionggplot2rstatsrstats-package

Resources

Readme
Activity

Stars

99 stars

Watchers

5 watching

Forks

16 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.