
This is my second attempt at the Tidytuesday. The above visual overlays UFO sighting with Bigfoot sighting in 2014. We see some overlap between the two. After generating the visual i edited this in Inkscape.
library(maps)
library(ggplot2)
library(dplyr)
library(lubridate)
#####################
#UFO data cleaning
####################
ufo <- read.csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-06-25/ufo_sightings.csv",stringsAsFactors = FALSE)
ufo$date_time <- mdy_hm(ufo$date_time)
ufo %>% mutate(yr= year(date_time))->ufo_new
ufo_new %>% filter(country =="us" & yr==2014 & state !="hi" & state !="ak") %>% na.omit()->ufo_new
#######################
#Bigfoot data cleaning
######################
bigft <- read.csv("https://query.data.world/s/3bela6acmtb2em5srqqzghgws5zeik", stringsAsFactors = FALSE)
bigft$date <- ymd(bigft$date)
bigft %>% mutate(yr= year(date))->bigft_new
bigft_new %>% filter(yr==2014)%>%
na.omit()->bigft_new
###################################
# Plot
###################################
ufo_theme <- theme(plot.title = element_text(colour = "white"),
plot.subtitle = element_text(colour = "white"),
plot.caption = element_text(colour = "white"),
plot.background = element_rect(fill = "black"),
panel.background = element_rect(fill = "black", colour = "black"),
panel.border = element_blank(),
panel.grid.major.y = element_blank(),
panel.grid.minor.y = element_blank(),
panel.grid.major.x = element_blank(),
panel.grid.minor.x = element_blank(),
axis.title = element_blank(),
axis.ticks = element_blank(),
axis.text = element_blank(),
legend.background=element_rect(fill = "black"),
legend.key= element_rect(fill = "black", color="black"),
legend.text=element_text(colour = "white", size = 10),
legend.key.size = unit(13,"point"))
ggplot()+
borders("state") +
geom_point(ufo_new,mapping= aes(x = longitude, y = latitude, color= "UFO"))+
geom_point(bigft_new,mapping=aes(x = longitude, y = latitude,color = "BigFoot"))+
labs(title = "UFO and Big Foot sighting in 2014",
subtitle="TidyTuesday Week June 25,2019",
caption="atmajitgohil.com")+
scale_color_manual(name = "Year",
labels = c("BigFoot", "UFO"),
values = c("blue","red"))+
ufo_theme
Leave a Reply