forked from rdpeng/ExData_Plotting1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot4.R
More file actions
37 lines (31 loc) · 1.04 KB
/
Copy pathplot4.R
File metadata and controls
37 lines (31 loc) · 1.04 KB
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
plot4 <- function(data) {
png('plot4.png')
par(mfrow = c(2,2))
plot(data$Time, data$Global_active_power,
type = 'n',
xlab = "",
ylab = "Global Active Power")
lines(data$Time, data$Global_active_power)
plot(data$Time, data$Voltage,
type = "n",
xlab = "datetime",
ylab = "Voltage")
lines(data$Time, data$Voltage)
plot(data$Time, data$Sub_metering_1,
type='n',
xlab = "",
ylab = "Energy sub metering")
legend("topright",
legend=c('Sub_metering_1', 'Sub_metering_2', 'Sub_metering_3'),
col= c('black', 'red', 'blue'),
lty = 1)
lines(data$Time, data$Sub_metering_1, col='black')
lines(data$Time, data$Sub_metering_2, col='red')
lines(data$Time, data$Sub_metering_3, col='blue')
plot(data$Time, data$Global_reactive_power,
type = "n",
xlab = "datetime",
ylab = "Global_reactive_power")
lines(data$Time, data$Global_reactive_power)
dev.off()
}