Skip to contents

Draws how a GitHub user contributes, from what collect_stats() collects: their pull requests, issues, reviews and new repositories, the days of the week they work on, and the repositories they commit to most, as a card for a GitHub profile, a PNG or an SVG file, in a dark or a light mode.

Usage

plot_activity_card(
  stats = "rghcard-data",
  file = "rghcard-activity.png",
  theme = c("dark", "light"),
  panels = NULL,
  title = NULL,
  width = 900
)

Arguments

stats

The statistics: what collect_stats() or read_stats() return, or the folder of the history.

file

The card: a .png or an .svg file. NULL returns the SVG code instead.

theme

"dark" or "light": the colors of GitHub's dark or light mode.

panels

One to three charts: "contribution_types", "weekdays" and "top_committed", or those of the other cards. By default all three, in that order.

title

The title, by default the user name.

width

Width of the card in pixels. A PNG has twice as many, to stay sharp on high-resolution screens.

Value

The file, invisibly, or the SVG code when file is NULL.

Details

The key figures are the pull requests, issues, reviews and repositories that the user created since they joined GitHub, as their contribution graph counts them, and their followers. By default the charts are:

  • "contribution_types": the contributions since the user joined GitHub by type, as a ring with a legend: commits, pull requests, issues, reviews, new repositories, and the private contributions that the profile shows as bare numbers. Each type has a color of its own.

  • "weekdays": the contributions of each day of the week in the 12 full months before the collection, as columns.

  • "top_committed": the five repositories with the most commits of the user since they joined GitHub, their own or those of others, whose names then start with their owner.

The days are UTC days, as GitHub counts them. The contributions of each type come from the same token as the contributions, so they are what the contributions card counts.

See also

view_card() shows the card in the Viewer or the Plots pane, plot_contributions_card() draws the contributions themselves, and use_rghcard_action() refreshes the cards on your profile.

Examples

card <- plot_activity_card(get_example_stats(), tempfile(fileext = ".svg"))
view_card(card, "plots")

plot_activity_card(get_example_stats(), tempfile(fileext = ".png"), theme = "light")