forked from rdpeng/ExData_Plotting1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot2.R
More file actions
42 lines (36 loc) · 852 Bytes
/
plot2.R
File metadata and controls
42 lines (36 loc) · 852 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
36
37
38
39
40
41
####
#
# Author: Toby Patterson
# File: plot2.R
# Date: 7 August 2014
#
# Plots the relationship between days of week and Global Active Power (in kilowatts)
# Presumes the file project1_datafile.Rda exists in the same directory.
#
####
# Read in the table data
# Note you may need to run generate_datafile.R if this file does not exist
data_file = 'project1_datafile.Rda'
if ( !file.exists(data_file)) {
stop('Run generate_datafile.R to create the project working datafile.')
}
# We're save
power = load(data_file)
# Output to file
canvas_size = 480
png(
file="plot2.png",
height = canvas_size,
width=canvas_size
)
plot(
data$DateTime,
data$Global_active_power,
ylab='Global Active Power (kilowatts)',
xlab='',
type='l'
)
# Yes I do want this
mtext('generated by Toby Patterson, 7 Sept 2014',1,4,cex=.5)
# Detatch
dev.off()