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
12 lines (12 loc) · 788 Bytes
/
plot4.R
File metadata and controls
12 lines (12 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
png(filename='plot4.png', height=480, width=480)
par(mfrow=c(2,2), mar=c(4,4,2,1), oma=c(0,0,2,0))
with(dtsub, {
plot(Global_active_power~as.POSIXct(dtsub$Time), type="l", xlab="", ylab="Global Active Power (kilowatts)")
plot(Voltage~as.POSIXct(dtsub$Time), type="l", xlab="", ylab="Voltage (volt)")
plot(Sub_metering_1~as.POSIXct(dtsub$Time), type="l", xlab="", ylab="Global Active Power (kilowatts)")
lines(Sub_metering_2~as.POSIXct(dtsub$Time),col='Red')
lines(Sub_metering_3~as.POSIXct(dtsub$Time),col='Blue')
legend(col=c("black", "red", "blue"), lty=1, lwd=2, bty="n", legend=c("Sub_metering_1", "Sub_metering_2", "Sub_metering_3"), "topright")
plot(Global_reactive_power~as.POSIXct(dtsub$Time), type="l", xlab="", ylab="Global Rective Power (kilowatts)")
})
dev.off()