• <bdo id='LHNcS'></bdo><ul id='LHNcS'></ul>
    1. <small id='LHNcS'></small><noframes id='LHNcS'>

    2. <i id='LHNcS'><tr id='LHNcS'><dt id='LHNcS'><q id='LHNcS'><span id='LHNcS'><b id='LHNcS'><form id='LHNcS'><ins id='LHNcS'></ins><ul id='LHNcS'></ul><sub id='LHNcS'></sub></form><legend id='LHNcS'></legend><bdo id='LHNcS'><pre id='LHNcS'><center id='LHNcS'></center></pre></bdo></b><th id='LHNcS'></th></span></q></dt></tr></i><div id='LHNcS'><tfoot id='LHNcS'></tfoot><dl id='LHNcS'><fieldset id='LHNcS'></fieldset></dl></div>

    3. <legend id='LHNcS'><style id='LHNcS'><dir id='LHNcS'><q id='LHNcS'></q></dir></style></legend>
        <tfoot id='LHNcS'></tfoot>

        带有 R 中 addCircleMarkers 的传单地图的传说中的圆

        时间:2023-08-08
      1. <i id='eDYzd'><tr id='eDYzd'><dt id='eDYzd'><q id='eDYzd'><span id='eDYzd'><b id='eDYzd'><form id='eDYzd'><ins id='eDYzd'></ins><ul id='eDYzd'></ul><sub id='eDYzd'></sub></form><legend id='eDYzd'></legend><bdo id='eDYzd'><pre id='eDYzd'><center id='eDYzd'></center></pre></bdo></b><th id='eDYzd'></th></span></q></dt></tr></i><div id='eDYzd'><tfoot id='eDYzd'></tfoot><dl id='eDYzd'><fieldset id='eDYzd'></fieldset></dl></div>

          <bdo id='eDYzd'></bdo><ul id='eDYzd'></ul>
        • <tfoot id='eDYzd'></tfoot>

            1. <small id='eDYzd'></small><noframes id='eDYzd'>

              <legend id='eDYzd'><style id='eDYzd'><dir id='eDYzd'><q id='eDYzd'></q></dir></style></legend>
                  <tbody id='eDYzd'></tbody>

                  本文介绍了带有 R 中 addCircleMarkers 的传单地图的传说中的圆圈 - 没有闪亮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在 R 中创建传单地图 - 我不需要构建一个闪亮的应用程序,并且还没有解决那个特定的技能集!

                  我试图在这里跟随这篇文章在我的传奇中创建圈子:

                  解决方案

                  从原始答案中,您省略了一组负责圆形的全局样式定义.

                  border-radius: 50%; 添加到 colorAdditions 一组 css 样式中,这是您需要的一种样式.

                  这将使:

                   colorAdditions <- paste0(colors, ";border-radius: 50%; width:", sizes, "px; height:", sizes, "px")

                  有点hacky,但可以.

                  I am creating a leaflet map in R - I don't need to build a shiny app, and haven't tackled that particular skill set yet!

                  I was trying to follow along with this post here to create circles in my legend: Creating legend with circles leaflet R .

                  However, I'm not sure how to incorporate the tags$style attribute to my R code as @K. Rhode suggested to ensure the legend items are circles. In my code, the legend comes up with squares. So close!

                  Can anyone help me nudge this code into making the legend items circles?

                  library(leaflet)
                  library(dplyr)
                  
                  #create data
                  Points<-data.frame(x=runif(10,20,21), y=runif(10,0,1), 
                                     var=c(rep(c(10,20, 40),3), 20))
                  Points <- Points %>% 
                    mutate(Category = case_when(var == 10 ~ "A", 
                                                var == 20 ~ "B",
                                                TRUE ~ "C"),
                           color = case_when(Category == "A" ~ "blue",
                                             Category == "B" ~ "blue",
                                             TRUE ~ "red"))
                  
                  
                  map = leaflet() %>% 
                    addTiles()
                  
                  addLegendCustom <- function(map, colors, labels, sizes, opacity = 0.5){
                    colorAdditions <- paste0(colors, "; width:", sizes, "px; height:", sizes, "px")
                    labelAdditions <- paste0("<div style='display: inline-block;height: ", 
                                             sizes, "px;margin-top: 4px;line-height: ", sizes, "px;'>", 
                                             labels, "</div>")
                  
                    return(addLegend(map, colors = colorAdditions, 
                                     labels = labelAdditions, opacity = opacity))
                  }
                  
                  
                  map %>% 
                    addCircleMarkers(Points$x,Points$y,radius=Points$var, 
                                     color = Points$color, 
                                     stroke = FALSE, fillOpacity = 0.5) %>%
                    addLegendCustom(colors = c("blue", "blue", "red"), 
                                    labels = c("A", "B", "C"), sizes = c(10, 20, 40))
                  

                  In the legend I'd prefer circle markers... not squares as below!

                  解决方案

                  From the original answer, you omitted one set of global style definition that is responsible for the round shape.

                  Add border-radius: 50%; to the colorAdditions set of css styles, which is the one style you are needing from it.

                  This would make:

                    colorAdditions <- paste0(colors, "; border-radius: 50%; width:", sizes, "px; height:", sizes, "px")
                  

                  A bit hacky, but works.

                  这篇关于带有 R 中 addCircleMarkers 的传单地图的传说中的圆圈 - 没有闪亮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:基于 Leaflet 和 AngularJS 的地图未正确加载 下一篇:传单 - 模式在地图后面打开

                  相关文章

                  最新文章

                    <bdo id='hyBhM'></bdo><ul id='hyBhM'></ul>

                  <i id='hyBhM'><tr id='hyBhM'><dt id='hyBhM'><q id='hyBhM'><span id='hyBhM'><b id='hyBhM'><form id='hyBhM'><ins id='hyBhM'></ins><ul id='hyBhM'></ul><sub id='hyBhM'></sub></form><legend id='hyBhM'></legend><bdo id='hyBhM'><pre id='hyBhM'><center id='hyBhM'></center></pre></bdo></b><th id='hyBhM'></th></span></q></dt></tr></i><div id='hyBhM'><tfoot id='hyBhM'></tfoot><dl id='hyBhM'><fieldset id='hyBhM'></fieldset></dl></div>

                    1. <legend id='hyBhM'><style id='hyBhM'><dir id='hyBhM'><q id='hyBhM'></q></dir></style></legend>

                    2. <tfoot id='hyBhM'></tfoot>

                      <small id='hyBhM'></small><noframes id='hyBhM'>