但当使用ggplotly显示时,它如下所示:
这是我使用的代码的核心:
random_map <- ggplot() +
geom_map(data = random_data, aes(map_id = random_data$ï..CCG, fill = random_data$Number),
map = CCGshape) +
geom_polygon (data = CCGshape, aes(x = long, y = lat, group = group),
colour = "azure4", size = 0.01, fill = NA) +
expand_limits(x = CCGshape$long, y = CCGshape$lat) +
coord_equal ()
random_plotly <- ggplotly(random_map)
我使用的shapefile是
here
.
这是我使用的数据的头部:
structure(list(Number = c(1, 0.4, 0.9, 0.3, 0.3, 0.7),
CCG = c("NHS Airedale, Wharfedale and Craven CCG",
"NHS Barnsley CCG", "NHS Bassetlaw CCG", "NHS Bradford Districts CCG",
"NHS Calderdale CCG", "NHS Bradford City CCG")), .Names = c("Number",
"CCG"), row.names = c(NA, 6L), class = "data.frame")
知道我做错了什么吗?