/
README.Rmd
72 lines (60 loc) · 3.3 KB
/
README.Rmd
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---------------------------------------------------------------------------------------------------------------------------------
title: "GGPLOT2 GEOM"
author: "ZIDA"
date: "March 25, 2019"
output:
html_document:
keep_md: true
---------------------------------------------------------------------------------------------------------------------------------
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Runnig geom
For Hurricane Ike
```{r }
library(dplyr)
library(ggmap)
library(buildnewgeomwk4)
library(gridExtra)
library(lubridate)
ext_tracks<-read_ext_tracks(file="ebtrk_atlc_1988_2015.txt")
tidy_ext_tracks<-tidy_tracks(ext_tracks=ext_tracks)
h_name <- "IKE"
h_time <- lubridate::ymd_h("2008 09 12 12")
storm_observation<-filter_(tidy_ext_tracks,
~storm_name %in% h_name,
~date %in% h_time)
loc<-unique(c(storm_observation$longitude,storm_observation$latitude))
# Since july 2018, using ggmap will fail unless you use Google Maps API Key. You will need to give Google your billing information,
# but you can create maps for free: more infos https://www.visibledata.co.uk/blog/2018/12/05/2018-12-05-using-ggmap-after-july-2018/
Normal<-get_map(location=loc,
zoom =6 , maptype = "toner-background") %>%
ggmap(extent = "device")+geom_hurricane(data=storm_observation,
mapping=aes(x=longitude,y=latitude,
r=wind_radius,
wind_speed=wind_speed,
quadrant=quadrant,
fill=as.factor(wind_speed),
color=as.factor(wind_speed)))+
scale_color_manual(name = "Wind speed (kts)",
values = c("red", "orange", "yellow")) +
scale_fill_manual(name = "Wind speed (kts)",
values = c("red", "orange", "yellow"))+
ggtitle("scale_radii=1.00")
Half<-get_map(location=loc,
zoom =6 , maptype = "toner-background") %>%
ggmap(extent = "device")+geom_hurricane(data=storm_observation,
mapping=aes(x=longitude,y=latitude,
r=wind_radius,
wind_speed=wind_speed,
quadrant=quadrant,
fill=as.factor(wind_speed),
color=as.factor(wind_speed),
scale_radii=0.5))+
scale_color_manual(name = "Wind speed (kts)",
values = c("red", "orange", "yellow")) +
scale_fill_manual(name = "Wind speed (kts)",
values = c("red", "orange", "yellow")) +
ggtitle("scale_radii = 50%")
gridExtra::grid.arrange(Normal,Half,ncol=2,nrow=1)
---------------------------------------------------------------------------------------------------------------------------------