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
10 lines (9 loc) · 673 Bytes
/
Copy pathplot1.R
File metadata and controls
10 lines (9 loc) · 673 Bytes
1
2
3
4
5
6
7
8
9
10
fileName="household_power_consumption.txt"
data5row <- read.table(fileName, header = TRUE, nrows = 5, sep=';', stringsAsFactors=FALSE)
classes <- sapply(data5row, class)
data <- read.table(fileName, header = TRUE, colClasses = classes, sep=';', na.strings = "?")
sdata <- data[data$Date %in% c("1/2/2007", "2/2/2007"),]
sdata$DateTime<-strptime(paste (sdata$Date, sdata$Time), format = "%d/%m/%Y %H:%M:%S" )
png(file = "plot1.png", width = 480, height = 480, units = "px", pointsize = 12, bg = "white")
hist(sdata$Global_active_power,col="red",xlab="Global ACtive Power (kilowatts)",ylab="Frequency",ylim=c(0,1200),main="Global Active Power",font.lab = 2,lwd=2)
dev.off()