Skip to content

Complex plots made easier

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

yogevherz/plotme

Repository files navigation

plotme

The {plotme} package provides a human friendly interface for plots that are otherwise quite hard to create in R. Currently only two functions exist, to create {plotly} sunburst and treemap plots, but (hopefully) more is to come.

Installation

devtools::install_github("yogevherz/plotme")

Usage

library(plotme)
library(dplyr)
library(palmerpenguins)

The count_to_sunburst() and count_to_treemap() functions are built to help you quickly create interactive hierarchical {plotly} plots from categorical data. The This can be very handy when exploring new datasets. The functions expect a summary table created by dplyr::count().

Quickly create a sunburst plot:

penguins %>% 
  count(island, species, sex) %>% 
  count_to_sunburst()

To change the hierarchy, simply change the order within the count() call:

penguins %>% 
  count(species, island, sex) %>% 
  count_to_sunburst()

Color groups by number of observations:

penguins %>% 
  count(species, island, sex) %>% 
  count_to_sunburst(fill_by_n = TRUE)

Make group size proportional to the sum of another variable (in this case, the sum of body mass):

penguins %>% 
  count(species, island, sex, wt = body_mass_g) %>% 
  count_to_sunburst(fill_by_n = TRUE)

Or easily create a treemap plot instead:

penguins %>% 
  count(species, island, sex, wt = body_mass_g) %>% 
  count_to_treemap(fill_by_n = TRUE)

About

Complex plots made easier

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Languages