Created
February 11, 2024 02:17
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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