forked from rdpeng/ExData_Plotting1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot4.R
18 lines (17 loc) · 780 Bytes
/
plot4.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Sets session to Display multiple plots
par(mfrow = c(2,2), mar = c(4,4,2,1), oma = c(0,0,2,0))
# Generating Plot 4
with(data3, {
plot(Global_active_power ~ Datetime, type = "l",
ylab = "Global Active Power", xlab = "")
plot(Voltage ~ Datetime, type = "l", ylab = "Voltage", xlab = "datetime")
plot(Sub_metering_1 ~ Datetime, type = "l", ylab = "Energy sub metering",
xlab = "")
lines(Sub_metering_2 ~ Datetime, col = 'Red')
lines(Sub_metering_3 ~ Datetime, col = 'Blue')
legend("topright", col = c("black", "red", "blue"), lty = 1, lwd = 2,
bty = "n",
legend = c("Sub_metering_1", "Sub_metering_2", "Sub_metering_3"))
plot(Global_reactive_power ~ Datetime, type = "l",
ylab = "Global_rective_power", xlab = "datetime")
})