【问题标题】:How to include a png file in R flexdashboard如何在 R flexdashboard 中包含 png 文件
【发布时间】:2019-12-27 16:50:53
【问题描述】:

您能帮我找到在 R flexdashboard 中打印 png 图像的正确代码吗?

这里是我的代码块:

    ---
    title: "Analyse des installations PV - Les Vergers"
    author: "Dario Santandrea"
    date: "`r format(Sys.time(), '%d %B, %Y')`"
    output:
     flexdashboard::flex_dashboard:
        orientation: rows
        vertical_layout: fill
     runtime: shiny

    ---

第一次尝试


renderImage({

  outfile <- tempfile(fileext = "X:/LesVergers/Analyse/BilanSolaire/Figures/Solar_angle_scheme.png")

  png(outfile, width = 500, height = 400)
  dev.off()

  }

)

第二次尝试

#knitr::include_graphics("X:/LesVergers/Analyse/BilanSolaire/Figures/Solar_angle_scheme.png")

我一直在尝试打印的图像不会简单地出现在 flexdashboard 中

【问题讨论】:

    标签: png flexdashboard


    【解决方案1】:

    flexdashboard 本质上是 Markdown。因此参见例如this related thread.

    ```{r picture, echo = F, fig.cap = "Title", out.width = '100%'}
    knitr::include_graphics("picture.png")
    ```
    

    只需将此块放置在标准 flexdashboard 布局中即可:

    BLOCK1
    =====================================
    
    Row {data-width=1000}
    -----------------------------------------------------------------------
    
    ### A picture
    
    ```{r picture, echo = F, fig.cap = "Title", out.width = '100%'}
    knitr::include_graphics("picture.png")
    ```
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-12-22
      • 1970-01-01
      • 1970-01-01
      • 2021-12-17
      • 1970-01-01
      • 2016-07-31
      • 2017-09-26
      相关资源
      最近更新 更多