-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraph
More file actions
52 lines (37 loc) · 1.36 KB
/
Graph
File metadata and controls
52 lines (37 loc) · 1.36 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
# Climate
_R Studio_
library(readxl)
library(dplyr)
data <- read_excel("r_ch_azel.xlsx")
# import data
r_ch_azel <- read_xlsx("Document/temp/r_ch_azel.xlsx")
View(r_ch_azel)
# Ubah format tanggal
r_ch_azel$Tahun <- as.numeric(as.Date(paste(r_ch_azel$Tahun, "1" = "/")))
r_ch_azel <- r_ch_azel%>%mutate(year=substr(Tahun,1,4)) %>%
mutate_if(is.character,as.factor)
# Tampilkan data dengan tanggal dalam format double
print (data)
install.packages("ggplot2")
library(ggplot2)
r_ch_azel$Bulan <- factor(r_ch_azel$Bulan, levels = c("Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agust", "Sep", "Okt", "Nov", "Des"))
ggplot(r_ch_azel, aes(x=Date, y=Kec_angin, col=Stasiun, group=Stasiun)) + geom_line()+
xlab("Waktu") + ylab (Kecepatan Angin (m/s)") + facet_grid(year~.) + theme_bw()
##Grafik Iklim Timeseries
data <- data.frame(r_ch_azel)
# Mengubah kolom karakter menjadi double
Tahun <- as.double(r_ch_azel)
# Menampilkan hasil
print(data)
# Kecepatan Angin
library(ggplot2)
p<-ggplot(r_ch_azel, as(x=Tahun, y=CH, group=Stasiun)) +
geom_line(aes(color=Stasiun))+
deom_point(aes(color=Stasiun))
p + theme(legend.position="right", legend.background = element_rect(fill="#ECECEC",
size, 1.5, linrtype="solid"))
install.packages(ggplot2)
library(ggplot2)
excel<- R_Kec_Angin_Time_Series
ggplot(excel, aes(x=Tanggal, y=Kec_Angin, group=Stasiun))+
geom_line(aes(color=Stasiun))