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
30 lines (26 loc) · 810 Bytes
/
plot4.R
File metadata and controls
30 lines (26 loc) · 810 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
png("plot4.png", width=480, height=480)
par(mfrow=c(2,2))
plot(subset$DateTime, subset$Global_active_power,
type="l",
xlab="",
ylab="Global Active Power")
plot(subset$DateTime, subset$Voltage,
type="l",
xlab="datetime",
ylab="Voltage")
plot(subset$DateTime, subset$Sub_metering_1,
type="l",
xlab="",
ylab="Energy sub metering")
lines(subset$DateTime, subset$Sub_metering_2, col="red")
lines(subset$DateTime, subset$Sub_metering_3, col="blue")
legend("topright",
col=c("black","red","blue"),
lty=1,
bty="n",
legend=c("Sub_metering_1","Sub_metering_2","Sub_metering_3"))
plot(subset$DateTime, subset$Global_reactive_power,
type="l",
xlab="datetime",
ylab="Global Reactive Power")
dev.off()