bfro <- read_csv("bfro_reports_geocoded.csv")
states <- read_csv("states.csv")
df <-left_join(bfro,states, by = "state") %>%
drop_na(date) %>%
mutate(year = year(ymd(date))) %>%
select(year, code, state) %>%
group_by(year, code, state) %>%
summarise(count = n()) %>%
ungroup() %>%
mutate(hover = paste0(state, "\n", count))
bf_graph <- plot_geo(df,
locationmode = 'USA-states',
frame = ~year) %>%
add_trace(locations = ~code,
z = ~count,
zmin = 0,
zmax =max(df$count),
color = ~count,
colorscale = "Electric",
text = ~hover,
hoverinfo = 'text') %>%
layout(geo = list(scope = "usa"),
title = "Sasquatch Sightings per Year by State") %>%
config(displayModeBar = FALSE)
bf_graph
LS0tCnRpdGxlOiAiU2FzcXVhdGNoIFNpZ2h0aW5ncyBieSBTdGF0ZSBhbmQgWWVhciIKb3V0cHV0OiBodG1sX25vdGVib29rCi0tLQoKYGBge3J9CmxpYnJhcnkodGlkeXZlcnNlKQpsaWJyYXJ5KHBsb3RseSkKYGBgCgpgYGB7cn0KYmZybyA8LSByZWFkX2NzdigiYmZyb19yZXBvcnRzX2dlb2NvZGVkLmNzdiIpCnN0YXRlcyA8LSByZWFkX2Nzdigic3RhdGVzLmNzdiIpCmBgYApgYGB7cn0KZGYgPC1sZWZ0X2pvaW4oYmZybyxzdGF0ZXMsIGJ5ID0gInN0YXRlIikgJT4lCiAgZHJvcF9uYShkYXRlKSAlPiUKICBtdXRhdGUoeWVhciA9IHllYXIoeW1kKGRhdGUpKSkgJT4lICAKICBzZWxlY3QoeWVhciwgY29kZSwgc3RhdGUpICU+JSAKICBncm91cF9ieSh5ZWFyLCBjb2RlLCBzdGF0ZSkgJT4lIAogIHN1bW1hcmlzZShjb3VudCA9IG4oKSkgJT4lIAogIHVuZ3JvdXAoKSAlPiUgCiAgbXV0YXRlKGhvdmVyID0gcGFzdGUwKHN0YXRlLCAiXG4iLCBjb3VudCkpCmBgYApgYGB7cn0KYmZfZ3JhcGggPC0gcGxvdF9nZW8oZGYsCiAgICAgICAgICAgICAg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