【问题标题】:Create an adjustable R leaflet with dashboard使用仪表板创建可调整的 R 传单
【发布时间】:2019-09-13 13:58:27
【问题描述】:

我正在尝试在仪表板中创建传单图像。这是我到目前为止的截图:

我的问题显然是地图高度降低了太多。如何修复传单图表的高度(无论有没有单独的侧边栏都更吸引人)?

这是我的代码:

---
title: "Untitled"
runtime: shiny
output: flexdashboard::flex_dashboard # !!!
---

```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(leaflet)

qty_d <- tibble(latt = c(50, 53),
                long = c(10, 16),
                qty = c(200, 140),
                planttext = c("AAA", "BBB"))
```

Page 1
======

Column1 {.sidebar}
------------------------------------------------
```{r}
sliderInput("bubblesize",
            label = "Bubble Size",
            min = 0.01, max = 0.1, value = 0.05, step = 0.02)

```

Column2 {}
-----------------------

```{r, echo=FALSE}
renderLeaflet({
  my_size <- input$bubblesize
  leaflet() %>%
  addTiles() %>%
  addCircleMarkers(lng = ~long, lat = ~latt, 
                   popup = ~planttext,
                   radius = ~qty * my_size, data = qty_d)
})
```

谢谢和亲切的问候

【问题讨论】:

    标签: r shiny leaflet shinydashboard


    【解决方案1】:

    this link 也有类似的问题。

    您的 flexdashboard 的解决方案是将您的 column2 代码替换为:

    ```{r, echo=FALSE}
    output$mymap = renderLeaflet({
      my_size <- input$bubblesize
      leaflet() %>%
      addTiles() %>%
      addCircleMarkers(lng = ~long, lat = ~latt, 
                       popup = ~planttext,
                       radius = ~qty * my_size, data = qty_d)
    })
    
    leafletOutput('mymap', height=1000)
    ```
    

    【讨论】:

      猜你喜欢
      • 2018-10-08
      • 2020-04-16
      • 2011-11-19
      • 2015-09-18
      • 2015-10-14
      • 1970-01-01
      • 2018-10-29
      • 2014-10-01
      • 1970-01-01
      相关资源
      最近更新 更多