forked from rdpeng/ExData_Plotting1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot4.R
41 lines (29 loc) · 1.13 KB
/
plot4.R
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
32
33
34
35
36
37
38
39
40
#make 4th plot with 4 charts
mydata = read.csv("household_power_consumption_feb1and2.csv") # load in csv
png('plot4.png')
par(mfrow=c(2,2))
plot(mydata$Global_active_power, type="l", col="black", ann=FALSE, xaxt="n")
title(ylab="Global Active Power")
axis(1,label="Thu", at = 50)
axis(1, label = "Fri", at = 1450)
axis(1, label = "Sat", at = 2900)
plot(mydata$Voltage, type="l", col="black", ann=FALSE, xaxt="n")
title(ylab="Voltage")
title(xlab="datetime")
axis(1,label="Thu", at = 50)
axis(1, label = "Fri", at = 1450)
axis(1, label = "Sat", at = 2900)
plot(mydata$Sub_metering_1, type="l", col="black", ann=FALSE, xaxt="n")
lines(mydata$Sub_metering_2, type="l", col="red", ann=FALSE, xaxt="n")
lines(mydata$Sub_metering_3, type="l", col="blue", ann=FALSE, xaxt="n")
title(ylab="Energy sub metering")
axis(1,label="Thu", at = 50)
axis(1, label = "Fri", at = 1450)
axis(1, label = "Sat", at = 2900)
plot(mydata$Global_reactive_power, type="l", col="black", ann=FALSE, xaxt="n")
title(ylab="Global_reactive_power")
title(xlab="datetime")
axis(1,label="Thu", at = 50)
axis(1, label = "Fri", at = 1450)
axis(1, label = "Sat", at = 2900)
dev.off()