Title: | A Tiny Contribution Table Generator Based on 'ggplot2' |
---|---|
Description: | Contribution table for credit assignment based on 'ggplot2'. This can improve the author contribution information in academic journals and personal CV. |
Authors: | Shixiang Wang [aut, cre] |
Maintainer: | Shixiang Wang <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.2 |
Built: | 2024-08-20 02:28:54 UTC |
Source: | https://github.com/openbiox/contribution |
CRediT
A data.frame
See https://casrai.org/credit/
data("CRediT")
data("CRediT")
A demo for plotting contribution table
A data.frame
See data_raw directory
data("demo")
data("demo")
Generate contribution table
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 )
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 )
data |
a |
color_map |
color map for discrete order, either a length-3 vector for 3 contribution level:
None, Minor and Major; or a |
palette_name |
palette_name for plotting continuous contributions. See show_palette for available options. |
sort |
if |
show_legend |
if |
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. |
a ggplot2
object
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" )
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" )
palette
A data.frame
See https://github.com/williambelle/github-contribution-color-graph
data("palette")
data("palette")
Pull contributions from GitHub
pull_github( data = NULL, repo = NULL, owner = NULL, username = NULL, role = NULL, report_lines = FALSE, type = c("all", "add", "del"), .token = NULL )
pull_github( data = NULL, repo = NULL, owner = NULL, username = NULL, role = NULL, report_lines = FALSE, type = c("all", "add", "del"), .token = NULL )
data |
a |
repo |
repository name. |
owner |
repository owner. |
username |
username to pull. |
role |
user role in this repository. |
report_lines |
if |
type |
'all' for the sum of number of additions and deletions, 'add' for the number of additions and 'del' for the number of deletions. |
.token |
Authentication token. See |
a 'data.frameā
pull_github( repo = "UCSCXenaTools", owner = "ShixiangWang", username = "ShixiangWang", role = "developer" )
pull_github( repo = "UCSCXenaTools", owner = "ShixiangWang", username = "ShixiangWang", role = "developer" )
For unauthenticated requests, the rate limit allows for up to 60 requests per hour. For API requests using Basic Authentication or OAuth, you can make up to 5000 requests per hour. Here we use token to manage this. Obtain a personal access token (PAT) from here: https://github.com/settings/tokens.
pull_github_limit(.token = NULL)
pull_github_limit(.token = NULL)
.token |
Authentication token. |
Typically, you can set GITHUB_PAT
variable in your .Renviron
file using the following format:
GITHUB_PAT=8c70fd8419398999c9ac5bacf3192882193cadf2
You can also set it in your .Rprofile
file using the following format:
Sys.setenv(GITHUB_PAT="8c70fd8419398999c9ac5bacf3192882193cadf2")
For more on what to do with the PAT, see gh::gh_whoami.
a list
.
pull_github_limit()
pull_github_limit()
A modified version of plot.lisa_palette.
show_palette()
show_palette()
NULL
show_palette()
show_palette()