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
16 lines (14 loc) · 710 Bytes
/
plot4.R
File metadata and controls
16 lines (14 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
source("read_data.R")
png(filename="plot4.png", width=480, height=480)
colors <- c("black", "red", "blue")
par(mfrow=c(2, 2))
with(data, {
plot(datetime, Global_active_power, type="o", pch=NA, ylab="Global active power", xlab=NA)
plot(datetime, Voltage, type="o", pch=NA)
plot(datetime, Sub_metering_1, type="o", pch=NA, ylab="Energy sub metering", xlab=NA)
points(datetime, Sub_metering_2, type="o", pch=NA, col="red")
points(datetime, Sub_metering_3, type="o", pch=NA, col="blue")
legend("topright", legend=c("Sub_metering_1", "Sub_metering_2", "Sub_metering_3"), col=colors, text.col=colors, lwd=1, box.lwd=0, inset=.01)
plot(datetime, Global_reactive_power, type="o", pch=NA)
})
dev.off()