generate {contribution}R Documentation

Generate contribution table

Description

Generate contribution table

Usage

generate(
  data,
  color_map = c("white", "grey", "black"),
  palette_name = "github",
  sort = FALSE,
  show_legend = FALSE,
  title = NULL,
  xlab = NULL,
  ylab = NULL,
  caption = NULL,
  tag = NULL,
  font_size_x = 16,
  font_size_y = 16,
  text_angle_x = 30,
  text_angle_y = 0,
  hjust_x = 0.2,
  hjust_y = 1,
  vjust_x = 1,
  vjust_y = 0.5,
  coord_ratio = 1
)

Arguments

data

a data.frame. e.g. data("demo").

color_map

color map for discrete order, either a length-3 vector for 3 contribution level: None, Minor and Major; or a Scale object like scale_fill_brewer(palette ="Oranges").

palette_name

palette_name for plotting continuous contributions. See show_palette for available options.

sort

if TRUE, sort the plot to make sure the plot is similar what input.

show_legend

if TRUE, show figure legend.

title

The text for the title.

xlab

x axis label.

ylab

y axis label.

caption

The text for the caption which will be displayed in the bottom-right of the plot by default.

tag

The text for the tag label which will be displayed at the top-left of the plot by default.

font_size_x

font size for x.

font_size_y

font size for y.

text_angle_x

text angle for x.

text_angle_y

text angle for y.

hjust_x

hjust for x axis text.

hjust_y

hjust for y axis text.

vjust_x

vjust for x axis text.

vjust_y

vjust for y axis text.

coord_ratio

coordinate ratio.

Value

a ggplot2 object

Examples

library(contribution)
library(ggplot2)

# Paper contributions
generate(demo)
generate(demo, text_angle_x = 20, color_map = scale_fill_brewer(palette = "Oranges"))

# Github project contributions
my_contr <- dplyr::tibble(
  repo = c("UCSCXenaTools", "maftools"),
  owner = c("ShixiangWang", "PoisonAlien"),
  username = "ShixiangWang",
  role = c("Developer", "Contributor")
)

my_contr

contr_tb <- pull_github(data = my_contr)
contr_tb

generate(contr_tb, show_legend = TRUE, hjust_x = 0)
generate(contr_tb,
  show_legend = TRUE, hjust_x = 0,
  palette_name = "psychedelic"
)

[Package contribution version 0.2.2 Index]