library(readr)
zim <- read_csv("~/Documents/Proposed papers/zim.csv")
## Parsed with column specification:
## cols(
## station = col_character(),
## month = col_double(),
## rainfall = col_double()
## )
View(zim)
attach(zim)
names(zim)
## [1] "station" "month" "rainfall"
library(ggplot2)#accelaring your plots
library(ggforce)
library(tidyverse)
## ── Attaching packages ───────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ tibble 2.1.3 ✔ dplyr 0.8.3
## ✔ tidyr 1.0.0 ✔ stringr 1.4.0
## ✔ purrr 0.3.2 ✔ forcats 0.4.0
## ── Conflicts ──────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library(nycflights13)
library(concaveman) # required for mark-hull
ggplot(zim,aes(month,rainfall,color=station))+
geom_point(show.legend=TRUE)+
theme_bw()

#the geomark
ggplot(zim,aes(month,rainfall,color=station))+
geom_point(show.legend=TRUE)+
theme_bw()+geom_mark_rect()

#label and arrow
ggplot(zim,aes(month,rainfall,color=station))+
geom_point(show.legend=TRUE)+
theme_bw()+geom_mark_rect(aes(label=station))

#label and arrow only drawn
ggplot(zim,aes(month,rainfall,color=station))+
geom_point(show.legend=FALSE)+
geom_mark_rect(aes(label=station),show.legend = FALSE)+
theme_void()

#### hull-k enhance
ggplot(zim,aes(month,rainfall,color=station))+
geom_point(show.legend=TRUE)+
geom_mark_hull(aes(label=station))+theme_void()

#### hull-k enhance filling with different collors
ggplot(zim,aes(month,rainfall,color=station))+
geom_point(show.legend=TRUE)+
geom_mark_hull(aes(label=station,fill=station),show.legend = FALSE)+
theme_void()

ggplot(zim,aes(month,rainfall,color=station))+
geom_point(show.legend=TRUE)+
geom_mark_hull(aes(label = station, fill = station), show.legend = FALSE, expand = unit(3, "mm")) +
theme_void()

ggplot(zim,aes(month,rainfall,color=station))+
geom_point(show.legend=TRUE)+
geom_mark_hull(aes(label = station, fill = station), show.legend = FALSE, expand = unit(3, "mm")) +
theme_no_axes()

### facet zoom
#the geomark
ggplot(zim,aes(month,rainfall,color=station))+
geom_point(show.legend=TRUE)+
theme_bw()+geom_mark_rect()+
facet_zoom(xlim = c(-155, -160.5), ylim = c(19, 22.3))
