diff --git a/bin/data-plots.R b/bin/data-plots.R index a41293b..fc7b861 100644 --- a/bin/data-plots.R +++ b/bin/data-plots.R @@ -7,9 +7,10 @@ library(ggthemes) library(plotly) library(htmlwidgets) library(lubridate) +library(ggrepel) -# Read in data from Wayback Machine archive of http://www.arrl.org/fcc-license-counts - +#### Total/State/Class #### +# Read in total/state/class data d_raw <- read.csv("data/us ham radio licenses over time.csv") # What dates do we have? @@ -33,6 +34,11 @@ d_total_long <- d_total %>% d_state_total_long <- d %>% filter(State.Territory != "TOTAL") %>% select(Date, State.Territory, Total, source_name, source_detail) %>% filter(!is.na(Total)) + +#### City #### +city_raw <- read.csv("data/us cities ham radio licenses over time.csv") +city <- city_raw %>% mutate(Date = as.Date(Date), + city_label = paste0(City, ", ", State)) #### Plots #### @@ -200,3 +206,54 @@ ggplot(data = d_state_total_long, theme(legend.position="bottom") ggsave("plots/states-over-time-freey.png", width = 15, height = 9) + +##### By city ##### +a <- city %>% group_by(city_label) %>% + mutate(plot_label = if_else(Date == max(Date), + city_label, + NA_character_)) +ggplot(data = a, + aes(x = Date, + y = Count, + color = city_label)) + + geom_line() + + geom_point(size = 0.3) + + scale_x_date(date_breaks = "1 years", + date_minor_breaks = "1 month", + date_labels = "%Y", + limits = c(NA_Date_, Sys.Date() + years(4))) + + scale_y_continuous(labels = scales::comma) + + theme_bw() + + geom_label_repel(aes(label = plot_label), + nudge_x = 1, + na.rm = TRUE, + segment.colour = NA) + + labs(title = "US Amateur Licenses by City", + y = "Count", + caption = "w1cdn.net") + + theme(legend.position="bottom") + + guides(color = "none") + +ggsave("plots/cities-over-time.png", width = 15, height = 9) + +##### By city, free y ##### +ggplot(data = city, + aes(x = Date, + y = Count, + group = city_label)) + + geom_line() + + geom_point(size = 0.3) + + facet_wrap(~city_label, + scales = "free_y" + ) + + scale_x_date(date_breaks = "4 years", + date_minor_breaks = "1 years", + date_labels = "%Y") + + scale_y_continuous(labels = scales::comma) + + theme_bw() + + labs(title = "US Amateur Licenses by City", + y = "Count", + caption = "w1cdn.net") + + theme(legend.position="bottom") + +ggsave("plots/cities-over-time-freey.png", width = 15, height = 9) diff --git a/data/us ham radio licenses over time.csv b/data/us ham radio licenses over time.csv index ee832f6..6befdb2 100644 --- a/data/us ham radio licenses over time.csv +++ b/data/us ham radio licenses over time.csv @@ -4255,3 +4255,9 @@ Date,State/Territory,Novice,Tech,Tech-Plus,General,Advanced,Extra,Total,Tech_and 2024-01-20,Wyoming,10,1027,,652,110,478,2277,,,,,,,,ARRL FCC License Counts,https://web.archive.org/web/20240122150020/https://www.arrl.org/fcc-license-counts 2024-01-20,Other*,1,281,,97,6,195,580,,,,,,,,ARRL FCC License Counts,https://web.archive.org/web/20240122150020/https://www.arrl.org/fcc-license-counts 2024-01-20,TOTAL,5823,374628,,186774,32189,155170,754584,,,,,,,,ARRL FCC License Counts,https://web.archive.org/web/20240122150020/https://www.arrl.org/fcc-license-counts +1986-02-28,TOTAL,79028,84478,,117407,98357,38931,418201,,,,,,,,FCC-W5YI,FCC numbers in W5YI Report 1989-04-01 p. 6 +1987-02-28,TOTAL,81445,85913,,11535,97727,41462,422082,,,,,,,,FCC-W5YI,FCC numbers in W5YI Report 1989-04-01 p. 6 +1988-02-28,TOTAL,82390,94361,,113949,98408,44205,433313,,,,,,,,FCC-W5YI,FCC numbers in W5YI Report 1989-04-01 p. 6 +1989-02-28,TOTAL,81092,104113,,114256,99491,47500,446452,,,,,,,,FCC-W5YI,FCC numbers in W5YI Report 1989-04-01 p. 6 +1989-03-31,TOTAL,82259,105002,,114606,99811,47734,449412,,,,,,,,FCC-W5YI,FCC numbers in W5YI Report 1989-05-15 p. 6 +1989-04-30,TOTAL,83371,106341,,114975,100183,48049,452919,,,,,,,,FCC-W5YI,FCC numbers in W5YI Report 1989-06-15 p. 7 diff --git a/plots/cities-over-time.png b/plots/cities-over-time.png index b418aa9..fe17443 100644 Binary files a/plots/cities-over-time.png and b/plots/cities-over-time.png differ diff --git a/plots/class-over-time-facet.png b/plots/class-over-time-facet.png index 0076916..f8cef3b 100644 Binary files a/plots/class-over-time-facet.png and b/plots/class-over-time-facet.png differ diff --git a/plots/class-over-time.png b/plots/class-over-time.png index 94e0ab4..4fbe8a2 100644 Binary files a/plots/class-over-time.png and b/plots/class-over-time.png differ diff --git a/plots/total-over-time-y.html b/plots/total-over-time-y.html index bb312e9..8ee5653 100644 --- a/plots/total-over-time-y.html +++ b/plots/total-over-time-y.html @@ -1942,11 +1942,11 @@ var n,i=t("./lib/build-log"),a=t("./lib/epsilon"),o=t("./lib/intersecter"),s=t("