Add more data and update plots.

Some plots modified a bit more than others. The stacked plot is a mess because of the different license classes, and the color-blind-friendly color scale breaks when there are too many colors.
This commit is contained in:
mattbk 2024-01-10 22:06:10 -06:00
parent ba5552054b
commit e99aed3617
7 changed files with 3353 additions and 3341 deletions

View File

@ -4,6 +4,10 @@ Data and code for analysis at https://mastodon.radio/@W1CDN/111723969200676208.
I'll get a blog post up at https://w1cdn.net at some point. I'll get a blog post up at https://w1cdn.net at some point.
This is a work in progress. It is not intended to be immediately useful for
detailed analysis, but to act as a guide for further investigation. As we figure out
how to slice up and caveat data, it will get more organized.
# Resources (not all integrated yet) # Resources (not all integrated yet)
- Various items in the [issue queue](https://amiok.net/gitea/W1CDN/ham-radio-licenses/issues) - Various items in the [issue queue](https://amiok.net/gitea/W1CDN/ham-radio-licenses/issues)
- Post from KE9V that started this: https://mastodon.sdf.org/@jdavis/111720350879036543 - Post from KE9V that started this: https://mastodon.sdf.org/@jdavis/111720350879036543

View File

@ -4,6 +4,8 @@ library(tidyr)
library(dplyr) library(dplyr)
library(forcats) library(forcats)
library(ggthemes) library(ggthemes)
library(plotly)
library(htmlwidgets)
# Read in data from Wayback Machine archive of http://www.arrl.org/fcc-license-counts # Read in data from Wayback Machine archive of http://www.arrl.org/fcc-license-counts
@ -16,39 +18,18 @@ unique(d_raw$Date)
d <- d_raw %>% d <- d_raw %>%
mutate(Date = as.Date(Date)) %>% mutate(Date = as.Date(Date)) %>%
# Drop Tech alone and leave Tech and Tech Plus # Drop Tech alone and leave Tech and Tech Plus
select(-c(Tech, Tech.Plus)) %>% select(-c(Tech, Tech.Plus))
mutate(across(c(3:8), as.numeric))
d_total <- d %>% filter(State.Territory == "TOTAL") d_total <- d %>% filter(State.Territory == "TOTAL")
d_total_long <- d_total %>% d_total_long <- d_total %>%
pivot_longer(cols = 3:8, pivot_longer(cols = !c("Date", "State.Territory", "source_name", "source_detail"),
names_to = "lclass", names_to = "lclass",
values_to = "count") %>% values_to = "count") %>%
# only keep rows with data so plots look right # only keep rows with data so plots look right
filter(!is.na(count)) filter(!is.na(count))
#### Plots #### #### Plots ####
##### Total over time #####
ggplot(data = d_total,
aes(x = Date,
y = Total,
color = source_name)) +
geom_line() +
geom_point(size = 0.3) +
scale_x_date(date_breaks = "10 years",
date_minor_breaks = "1 year",
date_labels = "%Y") +
scale_y_continuous(labels = scales::comma) +
theme_bw() +
labs(title = "US Amateur Licenses",
subtitle = "ARRL, AH0A",
caption = "w1cdn.net",
color = "Source") +
theme(legend.position="bottom")
ggsave("plots/total-over-time.png", width = 6, height = 4)
##### Total over time, y = 0 ##### ##### Total over time, y = 0 #####
ggplot(data = d_total, ggplot(data = d_total,
@ -64,13 +45,34 @@ ggplot(data = d_total,
limits = c(0, NA)) + limits = c(0, NA)) +
theme_bw() + theme_bw() +
labs(title = "US Amateur Licenses", labs(title = "US Amateur Licenses",
subtitle = "ARRL, AH0A",
caption = "w1cdn.net", caption = "w1cdn.net",
color = "Source") + color = "Source") +
theme(legend.position="bottom") theme(legend.position="bottom")
ggsave("plots/total-over-time-y.png", width = 6, height = 4) ggsave("plots/total-over-time-y.png", width = 6, height = 4)
p <- ggplotly()
htmlwidgets::saveWidget(as_widget(p), selfcontained = TRUE, file = "plots/total-over-time-y.html")
##### Total over time, since 2000 #####
ggplot(data = d_total %>% filter(Date >= as.Date("2000-01-01")),
aes(x = Date,
y = Total,
color = source_name)) +
geom_line() +
geom_point(size = 0.3) +
scale_x_date(date_breaks = "1 years",
date_minor_breaks = "3 months",
date_labels = "%Y") +
scale_y_continuous(labels = scales::comma) +
theme_bw() +
labs(title = "US Amateur Licenses since 2000",
caption = "w1cdn.net",
color = "Source") +
theme(legend.position="bottom")
ggsave("plots/total-over-time.png", width = 6, height = 4)
##### By license class ##### ##### By license class #####
ggplot(data = d_total_long %>% filter(lclass != "Total"), ggplot(data = d_total_long %>% filter(lclass != "Total"),
aes(x = Date, aes(x = Date,
@ -85,7 +87,6 @@ ggplot(data = d_total_long %>% filter(lclass != "Total"),
scale_color_colorblind() + scale_color_colorblind() +
theme_bw() + theme_bw() +
labs(title = "US Amateur Licenses by Class", labs(title = "US Amateur Licenses by Class",
subtitle = "ARRL, AH0A",
y = "Count", y = "Count",
color = "Class", color = "Class",
caption = "w1cdn.net") + caption = "w1cdn.net") +
@ -106,7 +107,6 @@ ggplot(data = d_total_long %>% filter(lclass != "Total"),
scale_y_continuous(labels = scales::comma) + scale_y_continuous(labels = scales::comma) +
theme_bw() + theme_bw() +
labs(title = "US Amateur Licenses by Class", labs(title = "US Amateur Licenses by Class",
subtitle = "ARRL, AH0A",
fill = "Class", fill = "Class",
caption = "w1cdn.net") + caption = "w1cdn.net") +
theme(legend.position="bottom") theme(legend.position="bottom")

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 KiB

After

Width:  |  Height:  |  Size: 224 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 168 KiB