forked from rdpeng/ExData_Plotting1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot1.R
52 lines (41 loc) · 1.59 KB
/
plot1.R
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
42
43
44
45
46
47
48
49
50
51
52
################################################
####...............Make Plot 1..............####
#### ####
#### Call make.plot() to run! ####
################################################
## This script overrides the function own_plot()
## and the integer plotnumber, which will be
## accessed by make.plot() in the utility script
#################################################
## own_plot implements the actual plot creation.
## While it can be called directly, it is rather
## intended to be called automatically from the
## make.plot() function, which is the usual
## starting point for plot creation of these
## scripts. Please refer to plot_utility.R for
## information on make.plot()
#################################################
own_plot <- function(df_plotting = df_february){
with(df_plotting,
hist(Global_active_power,
main="Global Active Power",
col= "orangered",
xlab ="Global active Power (kilowatts)"
)
)
}
plotnumber=1
## The process of loading and subsetting data,
## opening png devices, plotting, closing and
## previewing is the same for all plotting
## scripts of the first course assignment.
## I therefore decided to outsource those parts
## of the script into a utility-file.
## It is sourced whenever a "plot_n.R" file is
## run, unless it has already been sourced
## before (concept is similar to C++ Header
## Guards, for those of you familiar with
## the C++ preprocessor...)
if(!exists("utils_loaded")){
source("plot_utility.R")
}