首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在rworldmap中绘制区域数据

在rworldmap中绘制区域数据
EN

Stack Overflow用户
提问于 2018-01-26 18:32:17
回答 1查看 374关注 0票数 1

我使用的是rworldmap,我想将聚合的国家/地区数据绘制为区域。我看到有名为mapbyregioncountry2Region的函数,但如果我没理解错的话,区域是预先定义的,例如斯特恩区域。我想使用我自己选择的区域?这个是可能的吗?可以用另一个包来完成吗?

我有一个带有iso3代码的数据帧,我可以在其中声明一个国家所属的地区(我可以对其进行编辑以进行自己的分组。例如欧盟国家、高收入国家等)。

EN

回答 1

Stack Overflow用户

发布于 2018-02-05 02:39:28

其中一个应该会有帮助。

代码语言:javascript
复制
library(leaflet)
library(htmltools)

# example from ?leaflet
m = leaflet() %>% addTiles()

# there are two approaches to the custom css problem
#  1.  the easy but less robust way
browsable(
  tagList(list(
    tags$head(
      # you'll need to be very specific
      tags$style("p{font-size:200%;}")
      # could also use url
      #tags$link(href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css",rel="stylesheet")
    ),
    m
  ))
)





#  2.  you can add dependencies to your leaflet map
#  this mechanism will smartly handle duplicates
#  but carries a little more overhead
str(m$dependencies)  # should be null to start
# 
m$dependencies <- list(
  htmlDependency(
    name = "font-awesome"
    ,version = "4.3.0"
    # if local file use file instead of href below
    #  with an absolute path
    ,src = c(href="http://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css")
    ,stylesheet = "font-awesome.min.css"
  )
)

m
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48459616

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档