forked from rdpeng/ExData_Plotting1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot3.R
More file actions
35 lines (27 loc) · 820 Bytes
/
plot3.R
File metadata and controls
35 lines (27 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
## load packages
library(graphics)
library(grDevices)
## load the data using the R script load_data.R
source("./load_data.R")
## Create Plot 3
png(filename = "plot3.png")
with(household_power_consumption,
plot(datetime,
Sub_metering_1,
col = "black",
type = "l",
xlab = "",
ylab = 'Energy sub metering'))
with(household_power_consumption,
lines(datetime,
Sub_metering_2,
col = "red",
type = "l"))
with(household_power_consumption,
lines(datetime,
Sub_metering_3,
col = "blue",
type = "l"))
legend("topright", c("Sub_metering_1", "Sub_metering_2", "Sub_metering_3"), lwd = c(1, 1, 1), col = c("black", "red", "blue"))
dev.off()
remove(household_power_consumption)