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
38 lines (33 loc) · 827 Bytes
/
plot1.R
File metadata and controls
38 lines (33 loc) · 827 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
####
#
# Author: Toby Patterson
# File: plot1.R
# Date: 7 August 2014
#
# Create a basic histogram showing the frequency of 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.')
}
# Plot the relationship
canvas_size = 480
png(
file="plot1.png",
height = canvas_size,
width=canvas_size
)
hist(
data$Global_active_power,
main='Global Active Power',
xlab='Global Active Power (kilowatts)',
col='red'
)
# Yes I do want this
mtext('generated by Toby Patterson, 7 Sept 2014',1,4,cex=.5)
# Detatch
dev.off()