Skip to content

Commit

Permalink
added certifications to cum dives plot
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenpp7 committed Mar 8, 2021
1 parent 1e255ac commit 819a34c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
20 changes: 15 additions & 5 deletions R/cum_dives.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ cum_dives <- function(path = getwd()){
if(dir.exists(paste0(path, "/divewatchr_data"))){

load('divewatchr_data/scuba_map.RData')
load('divewatchr_data/scuba_cert.RData')
}

# } else {
Expand Down Expand Up @@ -56,11 +57,20 @@ ggplot(scuba_map_cum,
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +


geom_vline(xintercept = as.Date(c("2011-10-23", "2012-06-17", "2014-08-27", "2016-07-15")),
linetype = "dashed",
color = c("deepskyblue1","deepskyblue2","deepskyblue3","deepskyblue4"),
size = 0.6,
alpha = 0.6)
# geom_vline(xintercept = as.Date(c("2011-10-23", "2012-06-17", "2014-08-27", "2016-07-15")),
# linetype = "dashed",
# color = c("deepskyblue1","deepskyblue2","deepskyblue3","deepskyblue4"),
# size = 0.6,
# alpha = 0.6) +

# geom_label_repel(data = scuba_cert, aes(x = as.Date(certificationDate), y = nrow(scuba_map)/5, label = certificationName)) +
geom_jitter(data = scuba_cert, aes(x = as.Date(certificationDate),
y = -nrow(scuba_map)/(nrow(scuba_map)/10),
color = certificationName),
alpha = 0.35, size = 6) +

guides(color=guide_legend(title="Certification Name"))

}


Expand Down
3 changes: 2 additions & 1 deletion R/prep_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ print(st_crs(scuba_map))


# scuba_cert to character
scuba_cert <- scuba_cert %>% mutate(certificationDate = as.character(certificationDate))
scuba_cert <- scuba_cert %>% mutate(certificationDate = as.character(certificationDate)) %>%
arrange(certificationDate)


if(!is.na(data)){
Expand Down

0 comments on commit 819a34c

Please sign in to comment.