forked from rdpeng/ExData_Plotting1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlot2.R
More file actions
31 lines (23 loc) · 847 Bytes
/
Plot2.R
File metadata and controls
31 lines (23 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Plot2<-function(){
##
## Reads the subset file created using readData.R and creates Plot2.png
##
## read the file
##
dt<-read.csv("dataSubset.csv")
## convert the col ntime to POSIXlt class
##
dt$ntime<-strptime(dt$ntime, format("%Y-%m-%d %H:%M:%S"))
## change the locale to print the week days in english
##
actLC<-Sys.getlocale("LC_TIME")
Sys.setlocale("LC_TIME", "English")
png(file = "Plot2.png", width = 480, height = 480)
plot(dt$ntime, dt$Global_active_power, type="n",ylab="Global Active Power (kilowatts)", xlab="")
lines(dt$ntime, dt$Global_active_power)
## change the locale to default
##
Sys.setlocale("LC_TIME", actLC)
## close the PNG device
dev.off()
}