Skip to content

Instantly share code, notes, and snippets.

@paulovillarroel
Created February 11, 2024 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulovillarroel/8c49749115e189d361e50a782943b764 to your computer and use it in GitHub Desktop.
Save paulovillarroel/8c49749115e189d361e50a782943b764 to your computer and use it in GitHub Desktop.
The script visualizes the popularity trends of "R" and "Python" programming languages in Chile.
library(tidyverse)
# URL for the dataset
url <- "https://raw.githubusercontent.com/github/innovationgraph/main/data/languages.csv"
# Read the dataset
data <- read_csv(url)
# Perform data manipulation and aggregation
p <- data |>
mutate(periodo = paste0(year, " Q", quarter),
year_quarter = zoo::as.yearqtr(periodo)) |>
filter(iso2_code == "CL") |>
group_by(year_quarter, language) |>
summarise(num_pushers = sum(num_pushers)) |>
mutate(ranking = rank(-num_pushers))
# Create and customize the plot
p |>
filter(language %in% c("R", "Python")) |>
ggplot(aes(year_quarter, ranking, color = language)) +
geom_line(linewidth = 3, alpha = 0.5) +
geom_point(size = 6) +
labs(title = "Ranking of programming languages in Chile",
x = "Year",
y = "Ranking",
color = "Language",
caption = "Source: Github") +
scale_y_reverse(breaks = 30:1, labels = 30:1) +
scale_color_manual(values = c("R" = "#00509d", "Python" = "#fdc500")) +
theme_minimal() +
theme(plot.title = element_text(margin = margin(b = 20), size = 20),
plot.margin = margin(t = 20, r = 20, b = 20, l = 20))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment