forked from rdpeng/ExData_Plotting1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot1.R
More file actions
19 lines (13 loc) · 720 Bytes
/
plot1.R
File metadata and controls
19 lines (13 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
##########################################################
#read in, subset and structure data
##########################################################
ph <- read.table("household_power_consumption.txt", sep = ";", header = TRUE, na.strings = "?")
pset <- subset(ph, ph$Date == "1/2/2007" | ph$Date == "2/2/2007")
pset$DaTime <- strptime(paste(pset$Date, pset$Time), "%d/%m/%Y %H:%M:%S")
#########################################################
#plot 1
#########################################################
png(filename = "plot1.png", width = 480, height = 480, units = "px")
hist(pset$Global_active_power, main = "Global Active Power",
xlab = "Global Active Power (kilowatts)", col = "red")
dev.off()