forked from rdpeng/ExData_Plotting1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot3.R
More file actions
26 lines (19 loc) · 779 Bytes
/
Copy pathplot3.R
File metadata and controls
26 lines (19 loc) · 779 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
# declare function
source(".//ExData_Plotting1//loadData.R")
df <- loadData()
# define locale
curLocale <- Sys.getlocale("LC_TIME")
Sys.setlocale("LC_TIME","English_United States.1252")
# creating plot 3
par()
with(df,plot(datetime,Sub_metering_1,type="l",ylab = "Energy sub metering",xlab=" "))
with(df,points(datetime,Sub_metering_2,type="l",col="red"))
with(df,points(datetime,Sub_metering_3,type="l",col="blue"))
legend("topright", legend=c("Sub_metering_1","Sub_metering_2","Sub_metering_3"), lty = 1, col= c("black","red","blue"))
# creating png plot 3 - I'm using 800 x 600 for best visualization
dev.copy(png,file=".//ExData_Plotting1//Plot3.png",width = 800, height = 600)
dev.off()
#restore locale
Sys.setlocale("LC_TIME",curLocale)
#removing objects
remove(df)