我有 R 代码,它创建了一个传单地图,其中的点由addPolylines().
library(shiny)
library(leaflet)
station = c("A", "B", "C", "D", "E", "F")
latitude = c(-1.63, -1.62, -1.62, -1.77, -1.85, -1.85)
longitude = c(34.3, 34.4, 34.7, 34.3, 34.5, 34.7)
big = c(0, 20, 60, 90, 50, 10)
small = c(100, 80, 40, 10, 50, 90)
colour = c("blue", "blue", "red", "red", "black", "black")
group = c("A", "A", "B", "B", "C", "C")
df = cbind.data.frame(station, latitude, longitude, big, small, colour, group)
colnames(df) = c("station", "latitude", "longitude", "big", "small", "colour", …Run Code Online (Sandbox Code Playgroud) 我有一个数据框:
https://www.dropbox.com/s/51j3hh9urwjudu2/Agents.csv?dl=0
使用它,我可以使用以下代码创建传单地图:
map = leaflet() %>%
addTiles() %>% # Add default OpenStreetMap map tiles
addCircles(lng = agents$longitude, lat = agents$latitude,
popup=paste("Agent:", agents$Agent, "<br>",
"Satisfaction:", agents$Satisfaction, "<br>",
"No. Customers:", agents$Customers, "<br>",
"Colour Ref:", agents$Colour),
radius = agents$Customers * 10,
color = agents$Colour,
stroke = FALSE, fillOpacity = 0.5)
Run Code Online (Sandbox Code Playgroud)
看起来像这样:
现在,我想:
第一行以粗体显示(在本例中为“Agent 4”)。我试过插入:
"", agents$Agent, font = 2 "<br>",
Run Code Online (Sandbox Code Playgroud)
但这不起作用。
我还想标记“中”、“4200”和“绿色”,使它们彼此一致,更易于阅读。
有谁知道如何做到这一点?谢谢!