I have a spreadsheet with Lat-Lon info of 14 regions in the Czech Republic (file here). I am trying to plot a map and put bubbles for the active cases in each of the regions. The lat-lon coords are for capital cities from each region.
library(sf)
library(ggplot2)
library(maps)
library(rstudioapi)
library(dplyr)
library(ggmap)
library(mapproj)
library(viridis)
#----------------------------#
# Set your working directory #
#----------------------------#
setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) # RStudio IDE preferred
getwd() # Path to your working directory
# Country Boundary and the 14 regions within the Czech Republic
worldmap <- map_data("world")
worldmap2 <- dplyr::filter(worldmap, region %in% data.frame(countries = "Czech Republic"))
ggplot(worldmap2) + geom_polygon(aes(long,lat, group=group), col = "black", fill = "white", size = 1) +
labs(title = "COVID-19 in the Czech Republic", subtitle = "As of July 1, 2021", x = "Longitude", y = "Latitude",
caption = "(Source: Ministerstvo zdravotnictví České republiky)")
The sixth column of the spreadsheet has the active cases numbers. I am trying to get the numbers appear as bubbles on the above map. I tried the following but all dots are of the same size. How do I merge plot 1 and plot 2?
my_df <- read.csv("CZE_InitialSeedData.csv", header = T)
class(my_df)
my_sf <- st_as_sf(my_df, coords = c('Lon', 'Lat'))
my_sf <- st_set_crs(my_sf, value = 4326)
my_sf
seedPlot <- ggplot(my_sf) +
geom_sf(aes(fill = InitialInfections))
seedPlot <- seedPlot +
scale_fill_continuous(name = "Active Cases", low = "pink", high = "red", na.value = "grey50")
seedPlot <- seedPlot +
theme(legend.position = "bottom", legend.text.align = 1, legend.title.align = 0.5)
seedPlot