-
Notifications
You must be signed in to change notification settings - Fork 4
/
README.Rmd
121 lines (107 loc) · 3.07 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
---
output: github_document
---
```{r echo=FALSE, include=FALSE}
library(tidyverse)
library(gh)
library(lubridate)
library(knitr)
query = "ggplot+theme"
get_repos <- function(query) {
qstr <- glue::glue("GET /search/repositories?q={query}")
accept_hdr <- "application/vnd.github.mercy-preview+json"
res <- gh(qstr, .accept = accept_hdr)
pages <- ceiling(res$total_count / 30)
items <- c(res$items)
for (i in 2:pages) {
res <- gh(qstr, page = i, .accept = accept_hdr)
Sys.sleep(10) # to avoid hitting the API limit
items <- c(items, res$items)
}
return(items)
}
# get all repos that mention "ggplot2" and "theme"
res1 <- get_repos("ggplot2+theme")
Sys.sleep(30) # to avoid hitting the API limit
res2 <- get_repos("ggplot2+style")
Sys.sleep(30) # to avoid hitting the API limit
# topic search
# ggplot2-theme and ggplot2-themes
res3 <- get_repos("topic:ggplot2-themes")
Sys.sleep(30) # to avoid hitting the API limit
res4 <- get_repos("topic:ggplot2-theme")
res_items <- c(res1, res2, res3, res4)
fix_null <- function(x) {
ifelse(is_null(x), "", x)
}
github_ggplot2_themes <- tibble(
name = character(),
repo_url = character(),
description = character(),
homepage = character(),
license = character(),
created = character(),
updated = character()
)
# list of the repos to filter off
repos_no_themes <- c(
"jmcastagnetto/ggplot2_themes_in_github",
"dannguyen/matplotlib-styling-tutorial",
"davidhuh/plot_templates",
"jkeirstead/r-slopegraph",
"ArtPoon/ggfree",
"foxnic/US-Mass-Shootings-Analysis",
"guiastrennec/ggplus",
"threecifanggen/ggplotly",
"edawson/tidysig",
"elabuel-o/xkcd-graphics",
"pobch/ggplot2_practicing",
"rensa/ggclump",
"eclarke/ggbeeswarm",
"GeekOnAcid/geom_rug2",
"cemalley/data-viz",
"onlyphantom/rgraphics",
"sethbilliau/HODP-styleguide",
"uplotnik/TidyVerseAssignment.md",
"binmishr/Wrangling_and_Visualizing_Musical_Data_R"
)
for (item in res_items) {
# filter off repos w/o themes/styles
if (item$full_name %in% repos_no_themes) {
next
}
github_ggplot2_themes <- bind_rows(
github_ggplot2_themes,
tibble(
name = item$name,
repo_url = item$html_url,
description = fix_null(item$description),
homepage = fix_null(item$homepage),
license = fix_null(item$license$name),
created = item$created_at,
updated = item$updated_at,
)
)
}
github_ggplot2_themes <- github_ggplot2_themes %>%
distinct() %>%
arrange(name, created)
last_generated <- now(tzone = "UTC")
# save csv
write_csv(
github_ggplot2_themes,
path = "ggplot2_themes_in_github.csv"
)
```
# List of github repos with (possible) ggplot2 themes
**Last generated on** `r last_generated` (UTC)
- This list is generated using the github API, so it relies on the descriptions and tags in each repository
- Get the [data in CSV format](ggplot2_themes_in_github.csv)
- If you find a repo that doesn't contain a theme, submit an issue so I can add it to the filter
```{r echo=FALSE, results}
kable(github_ggplot2_themes %>%
rownames_to_column("item"),
format = "markdown"
)
```
*License*: MIT