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) · 720 Bytes
/
Copy pathplot4.R
File metadata and controls
12 lines (12 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
png("plot4.png", width=480, height=480)
source("load.R")
times <- strptime(paste(newdf$Date, newdf$Time, " "), "%d/%m/%Y %H:%M:%S")
par(mfrow=c(2,2))
plot(times, newdf$Global_active_power, type="l", ylab="Global Active Power (kilowatts)", xlab="")
plot(times, newdf$Voltage, type="l", ylab="Voltage", xlab="datetime")
plot(times, newdf$Sub_metering_1, type="l", ylab="Energy sub metering", xlab="")
lines(times,newdf$Sub_metering_2, col="red")
lines(times,newdf$Sub_metering_3, col="blue")
legend("topright", lty=1, col=c("black", "red", "blue"), legend=c("Sub_metering_1", "Sub_metering_2", "Sub_metering_3"))
plot(times, newdf$Global_reactive_power, type="l", ylab="Global_reactive_power", xlab="datetime")
dev.off()