library(knitr)
opts_chunk$set(echo = TRUE, warnings = FALSE, message = FALSE)
The following plot is created on Aug. 28, 2020 through leaflet
The map below would represent part of my journey from my home country to the United States. I pinpoint the location of different places on the world map and give them legends with a few words on my experiences. There are a lot more places I haven’t explore and wish one day I could have a map with memories all over the places :)
Codes are shown below.
library(leaflet)
df <- data.frame(name = c("Ziyang", "Chengdu", "Los Angeles, CA", "Beijing", "Columbia, MO", "Washington DC"),
area = c(2219, 5535, 502.73, 6490, 66.04, 68.34),
nation = c("CN", "CN","USA", "CN", "USA", "USA"),
lat = c(30.122474, 30.65883,34.052238, 39.904202, 38.947407, 38.885329),
lng = c(104.640881, 104.061874, -118.243340, 116.407394, -92.328155, -77.061607),
stringsAsFactors = FALSE)
poptext <- c("A place to start",
"The place of my longest stay before 18, and until today, I find it the best place to live",
"First time traveling abroad. Here I found my sweetest home stay family. 5 years later, I became an international student and paid a visit here again during thanksgiving break",
"In 2015, I came to this city alone for college. Everything's so fresh. And also, first time to see snow all over the place",
"2 years for college and first time working in a newsroom. Mix experiences of opening myself to a large number of different people",
"Got my first intership as a legal assisstant. Although leaving here alone was hard and expensive, the job itself made all worthwhile")
popcolor <- c("red","red","steelblue", "red","steelblue", "steelblue")
df %>%
leaflet() %>%
addTiles() %>%
addMarkers(popup = poptext) %>%
addCircles(weight = 10, radius = sqrt(df$area)*1000, color = popcolor, opacity = 0.6) %>%
addLegend(labels = paste(df$name, df$nation), colors = popcolor)