library(ggplot2)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
require(maps)
## Loading required package: maps
require(viridis)
## Loading required package: viridis
## Loading required package: viridisLite
##
## Attaching package: 'viridis'
## The following object is masked from 'package:maps':
##
## unemp
library(sf)
## Linking to GEOS 3.11.2, GDAL 3.7.2, PROJ 9.3.0; sf_use_s2() is TRUE
library(ggrepel)
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
theme_set(
theme_void()
)
map <- read_sf("shp indonesia/shp indonesia.shp")
map
map <- read_sf("shp indonesia/shp indonesia.shp")
ggplot(map) +
geom_sf(color = "white", aes(fill = NAME_1)) +
theme(legend.position = "none") +
geom_sf_text(aes(label = NAME_1), size = 2)
## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data

map <- read_sf("shp indonesia/shp indonesia.shp")
peta <- ggplot(map) +
geom_sf(color = "white", aes(fill = NAME_1)) +
theme(legend.position = "none") +
geom_text_repel(aes(label = paste0(NAME_1," (",Case,")") , geometry = geometry),
stat = "sf_coordinates", size = 3,
fun.geometry = sf::st_centroid,
max.overlaps=nrow(map),
min.segment.length = 0) + scale_radius(range = c(3,6))
peta

map <- read_sf("shp indonesia/shp indonesia.shp")
peta <- ggplot(map) +
geom_sf(color = "white", aes(fill = NAME_1)) +
theme(legend.position = "none") +
geom_text_repel(aes(label = paste0(NAME_1," (",Persentase,"%",")") , geometry = geometry),
stat = "sf_coordinates", size = 3,
fun.geometry = sf::st_centroid,
max.overlaps=nrow(map),
min.segment.length = 0) + scale_radius(range = c(3,6))
peta

map <- read_sf("shp indonesia/shp indonesia.shp")
peta <- ggplot(map) +
geom_sf(color = "white", aes(fill = Case)) +
geom_text_repel(aes(label = paste0(NAME_1," (",Case,")") , geometry = geometry),
stat = "sf_coordinates", size = 3,
fun.geometry = sf::st_centroid,
max.overlaps=nrow(map),
min.segment.length = 0) + scale_radius(range = c(3,6))
peta

map <- read_sf("shp indonesia/shp indonesia.shp")
peta <- ggplot(map) +
geom_sf(color = "white", aes(fill = Persentase)) +
geom_text_repel(aes(label = paste0(NAME_1," (",Persentase,"%",")") , geometry = geometry),
stat = "sf_coordinates", size = 3,
fun.geometry = sf::st_centroid,
max.overlaps=nrow(map),
min.segment.length = 0) + scale_radius(range = c(3,6)) +
scale_fill_viridis_c()
peta

map <- read_sf("shp indonesia/shp indonesia.shp")
peta <- ggplot(map) +
geom_sf(color = "white", aes(fill = NAME_1)) +
theme(legend.position = "none") +
geom_text_repel(aes(label = paste0(NAME_1," (",Persentase,"%",")") , geometry = geometry ),
stat = "sf_coordinates", size = 3)
peta
## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data
## Warning: ggrepel: 2 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

map <- read_sf("shp indonesia/shp indonesia.shp")
pengali = 0.1
p <- ggplot(map) +
geom_sf(fill = "white") +
geom_point(data = map, aes(x = longitude, y = latitude), size = map$Case * pengali,
shape = 20, fill = "orange", color = "orange" ) +
geom_text(data = map, aes(longitude, latitude, label = paste0(NAME_1," (",Case,")")), size = 2, color = "red",
hjust = 0, vjust = 0)
p

map <- read_sf("shp indonesia/shp indonesia.shp")
pengali = 0.1
p <- ggplot(map) +
geom_sf(color = "white", aes(fill = NAME_1)) +
geom_point(data = map, aes(x = longitude, y = latitude), size = map$Case * pengali,
shape = 20, fill = "orange", color = "orange" ) +
geom_text(data = map, aes(longitude, latitude, label = paste0(NAME_1," (",Case,")")), size = 2, color = "red",
hjust = 0, vjust = 0) +
theme(legend.position = "none")
p

map <- read_sf("shp indonesia/shp indonesia.shp")
pengali = 0.1
p <- ggplot(map) +
geom_sf(color = "white", aes(fill = NAME_1)) +
geom_point(data = map, aes(x = longitude, y = latitude), size = 5,
shape = 20, fill = "orange", color = "orange" ) +
geom_text(data = map, aes(longitude, latitude, label = paste0(NAME_1," (",Persentase,"%)")), size = 2, color = "red",
hjust = 0.5, vjust = 0) +
theme(legend.position = "none")
p

map <- read_sf("shp indonesia/shp indonesia.shp")
WARNA_TITIK_MANUAL <- c("blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","pink","blue","blue","green","orange","blue")
pengali = 0.1
p <- ggplot(map) +
geom_sf(fill = "white") +
geom_point(data = map, aes(x = longitude, y = latitude), size = 5,
shape = 20, fill = WARNA_TITIK_MANUAL, color = WARNA_TITIK_MANUAL ) +
geom_text(data = map, aes(longitude, latitude, label = paste0(NAME_1," (",Persentase,"%)")), size = 2, color = "red",
hjust = 0.5, vjust = 0) +
theme(legend.position = "none")
p

map <- read_sf("shp indonesia/shp indonesia.shp")
WARNA_TITIK_MANUAL <- c("blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","blue","pink","blue","blue","green","orange","blue")
pengali = 0.1
p <- ggplot(map) +
geom_sf(fill = "white") +
geom_point(data = map, aes(x = longitude, y = latitude), size = map$Persentase*2,
shape = 20, fill = WARNA_TITIK_MANUAL, color = WARNA_TITIK_MANUAL ) +
geom_text(data = map, aes(longitude, latitude, label = paste0(NAME_1," (",Persentase,"%)")), size = 2, color = "red",
hjust = 0.5, vjust = 0) +
theme(legend.position = "none")
p
