3

I have an R blog post with some leaflet and plotly figures. I can set width = "100%" in the leaflet() function, and the leaflet map will change shape as I resize my browser window (or view on mobile). I've tried the same width = "100%" in plot_ly(), but the plot doesn't resize for smaller windows and requires horizontal scrolling.

Any ideas? I'm using blogdown/hugo if that is helpful.

Kyle Ward
  • 889
  • 1
  • 8
  • 18

1 Answers1

9

Use the chunk option:

```{r, out.width='100%'}
Yihui Xie
  • 28,913
  • 23
  • 193
  • 419