2

Could you please help me in finding the right code to print a png image inside a R flexdashboard?

Here my code chunk:

    ---
    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

    ---

First attempt


renderImage({

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

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

  }

)

Second attempt

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

The image i've been trying to print doesn't simply appear in the flexdashboard

Dario
  • 21
  • 1
  • 2

1 Answers1

4

flexdashboard is essentially Markdown. Thus see e.g. this related thread.

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

Just place this chunk within the standard flexdashboard layout:

BLOCK1
=====================================

Row {data-width=1000}
-----------------------------------------------------------------------

### A picture

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