-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot4.R
More file actions
20 lines (14 loc) · 705 Bytes
/
plot4.R
File metadata and controls
20 lines (14 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
library(ggplot2)
library(plyr)
NEI <- readRDS("summarySCC_PM25.rds")
SCC <- readRDS("Source_Classification_Code.rds")
scc.combcoalMatches <- grepl("[Cc]omb(.*)[Cc]oal|[Cc]oal(.*)[Cc]omb", SCC$Short.Name, ignore.case=TRUE)
scc.code <- SCC[scc.combcoalMatches,]
NEI.CC <- NEI[NEI$SCC %in% scc.code$SCC,]
png("plot4.png",width=480,height=480,units="px",bg="transparent")
ggplot(NEI.CC,aes(factor(year),Emissions/10^5)) +
geom_bar(stat="identity",fill="grey",width=0.75) +
theme_bw() + guides(fill=FALSE) +
labs(x="year", y=expression("Total PM"[2.5]*" Emission (10^5 Tons)")) +
labs(title=expression("PM"[2.5]*" Coal Combustion Source Emissions Across US from 1999-2008"))
dev.off()