forked from ourcodingclub/CC-7-Github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSample_script.R
More file actions
56 lines (46 loc) · 2.05 KB
/
Copy pathSample_script.R
File metadata and controls
56 lines (46 loc) · 2.05 KB
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
53
54
55
############################################################
# #
# Github practice script Coding Club 01-03-2017 #
# #
############################################################
# Ebuka
# Claudia
# Add in purpose of this script
# To learn about version control on github
# git config --global user.email "you@example.com"
# git config --global user.name "Your Name"
# Libraries ----
library(ggplot2)
library(tidyr)
library(dplyr)
library(readr)
# Functions ----
# This is a ggplot function for a nice clean theme
# HINT: use this theme when making your plot later on
theme.clean <- function(){
theme_bw()+
theme(axis.text.x=element_text(size=12, angle=45, vjust=1, hjust=1),
axis.text.y=element_text(size=12),
axis.title.x=element_text(size=14, face="plain"),
axis.title.y=element_text(size=14, face="plain"),
panel.grid.major.x=element_blank(),
panel.grid.minor.x=element_blank(),
panel.grid.minor.y=element_blank(),
panel.grid.major.y=element_blank(),
plot.margin = unit(c(0.5, 0.5, 0.5, 0.5), units = , "cm"),
plot.title = element_text(size=20, vjust=1, hjust=0.5),
legend.text = element_text(size=12, face="italic"),
legend.title = element_blank(),
legend.position=c(0.9, 0.9))
}
# Load data ----
setwd("C:/Users/clauv/Desktop/Uni/Coding_club/Week_5/CC-7-Github")
temp_elevation <- read.csv("temp_elevation.csv")
# Make a plot showing how soil temperature changes with elevation ----
(temp.el <- ggplot (temp_elevation, aes(x=Elevation.m, y=Soil.temp.mean)) +
geom_point(colour = "#8B4513") +
geom_smooth(method = lm, colour = "#8B4513", fill = "#8B4513", alpha = 0.6) +
labs(x = "Elevation (m)", y = "Mean soil temperature (degC)") +
theme.clean())
# Save your plot in your project directory
# Commit, pull, push!