setwd("C:/Users/s-das/Syncplicity Folders/SHRP2 Visibility Study (TOG-CTS) (Brad Brimley)/FL_Buffer_5Miles/Test Set removing Holidays+Extreme Weather")
dat <- read.csv("Inclement-NoInclement.csv")
dat
## slope month fear_level value
## 1 -1 Non-inclement Fatal and Injury 0.46
## 2 -1 Non-inclement No Injury 0.54
## 3 1 Inclement Fatal and Injury 0.48
## 4 1 Inclement No Injury 0.52
library(tidyr)
library(ggplot2)
library(ggthemes)
library(scales)
library(dplyr)
gg <- ggplot(dat)
# line
gg <- gg + geom_line(aes(x=month, y=value, color=slope, group=fear_level), size=2)
# points
gg <- gg + geom_point(aes(x=month, y=value, fill=slope, group=fear_level),
color="white", shape=21, size=2.5)
# left labels
gg <- gg + geom_text(data=subset(dat, month=="Inclement"),
aes(x=month, y=value, label=sprintf("%s - %s ", fear_level, percent(value))),
hjust=1, size=5)
gg <- gg + geom_text(data=subset(dat, month=="Non-inclement"),
aes(x=month, y=value, label=sprintf("%s - %s ", percent(value), fear_level)),
hjust=-0.1, size=5)
gg <- gg + scale_y_continuous()
gg <- gg + theme_tufte(base_family="Helvetica")
gg <- gg + theme(axis.ticks=element_blank())
gg <- gg + theme(axis.text.y=element_blank())
gg <- gg + theme(legend.position="none")+ theme(axis.text.x = element_text(size=16))+labs(x=" ", y=" ")
gg
