diff --git a/plot3.R b/plot3.R new file mode 100644 index 00000000000..c5038b2d793 --- /dev/null +++ b/plot3.R @@ -0,0 +1,13 @@ +temp <- tempfile() +download.file('http://d396qusza40orc.cloudfront.net/exdata%2Fdata%2Fhousehold_power_consumption.zip',temp) +all_data<-read.csv(unzip(temp),sep = ";",header = T,quote = "",na.strings='?') +unlink(temp) +my_data<-subset(all_data,Date=='1/2/2007' | Date=='2/2/2007') +my_data$dt<-strptime(paste(my_data$Date,my_data$Time),"%d/%m/%Y %T") +png('plot3.png',bg = "transparent") +plot(my_data$dt,my_data$Sub_metering_1,ylab='Energy Submetering',xlab='',t='n') +lines(my_data$dt,my_data$Sub_metering_1,col='black') +lines(my_data$dt,my_data$Sub_metering_2,col='red') +lines(my_data$dt,my_data$Sub_metering_3,col='blue') +legend('topright',col=c("black","red","blue"),legend = c("Sub_metering_1","Sub_metering_2","Sub_metering_3"),lwd=1) +dev.off() \ No newline at end of file diff --git a/plot3.png b/plot3.png new file mode 100644 index 00000000000..e87afebc76e Binary files /dev/null and b/plot3.png differ