Skip to content

Instantly share code, notes, and snippets.

@cavedave
Created November 25, 2021 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cavedave/66979080071f59a49014c8059b33ca12 to your computer and use it in GitHub Desktop.
Save cavedave/66979080071f59a49014c8059b33ca12 to your computer and use it in GitHub Desktop.
Year Recorded
1975 49293
1980 52552
1985 38637
1988 35251
1990 23484
1993 10487
1995 7035
2000 719
2005 1979
2010 1352
2011 650
2012 223
2013 416
2014 359
2015 74
2016 37
2017 22
2018 33
2019 176
2020 140
2021 2
library(dplyr)
library(ggplot2)
library(ggthemes)
library(scales)
mydata = read.csv("Polio.csv", sep=",")
mydata2<-mydata %>% select(Recorded,Year) %>% mutate(log2= log(Recorded))
p<- ggplot(mydata2, aes(Year, Recorded))+
theme_update(plot.title = element_text(hjust = 0.5))+
theme_tufte() +
geom_point(color='#d498a3') +
scale_y_log10(breaks = trans_breaks("log10", function(x) 10^x),
labels = trans_format("log10", math_format(10^.x)))+
annotate("text", x = 1994, y = 5, label = "Americas", size = 4.0,angle = 90)+
annotate("segment", x = 1994, xend = 1994, y = 1, yend = 20, colour = "firebrick3", size = 0.25)+
annotate("text", x = 2000, y = 5, label = "Pacific West", size = 4.0,angle = 90)+
annotate("segment", x = 2000, xend = 2000, y = 1, yend = 20, colour = "firebrick3", size = 0.25)+
annotate("text", x = 2015, y = 5, label = "Nigeria", size = 4.0,angle = 90)+
annotate("segment", x = 2015, xend = 2015, y = 2, yend = 16, colour = "firebrick3", size = 0.25)+
annotate("text", x = 2011, y = 5, label = "India", size = 4.0,angle = 90)+
annotate("segment", x = 2011, xend = 2011, y = 2, yend = 13, colour = "firebrick3", size = 0.25)+
annotate("text", x = 2020, y = 5, label = "Africa", size = 4.0,angle = 90)+
annotate("segment", x = 2020, xend = 2020, y = 2, yend = 13, colour = "firebrick3", size = 0.25)
#scale_y_continuous(trans='log2')+
#scale_y_sqrt()+
p<-p + ggtitle("Wild Polio Cases per Year") +
ylab("Cases (log)") + xlab("Year") +theme_bw()+ theme(plot.title = element_text(hjust = 0.5))
p
ggsave("Polio.png")
@cavedave
Copy link
Author

Polio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment