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
20 lines (17 loc) · 859 Bytes
/
plot4.R
File metadata and controls
20 lines (17 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
## plot 2
source("load_data.R")
png(filename="plot4.png")
par(mfrow = c(2, 2))
with(epc_plot, plot(Time, Global_active_power, type = "l", ylab = "Global Active Power (kilowatts)",
xlab = ""))
with(epc_plot, plot(Time, Voltage, type = "l", ylab = "Voltage",
xlab = "datetime"))
with(epc_plot, plot(Time, Sub_metering_1, type = "l", ylab = "Energy sub metering",
xlab = ""))
with(epc_plot, lines(Time, Sub_metering_2, type = "l", col = "red"))
with(epc_plot, lines(Time, Sub_metering_3, type = "l", col = "blue"))
legend("topright", col=c("black","red","blue"), c("Sub_metering_1 ","Sub_metering_2 ", "Sub_metering_3"),
lty = 1)
with(epc_plot, plot(Time, Global_reactive_power, type = "l", ylab = "Global reactive power",
xlab = "datetime"))
dev.off()