0

I would like to create a plot with ggplotly() in R by allowing dynamic height/width so that it will look something like this in the html:

<div id="htmlwidget-7c8a8e27b8ce66400314" style="width:100%;height:100%;" class="plotly html-widget"></div>

with: width/height=100%

However, this doesn't seem to be allowed in ggplotly(): This

ggplotly(p, size=“100%”, height=“100%”) will throw an error.

It looks like this is possible when using RShiny plotlyOutput (e.g. https://community.plotly.com/t/plotly-shiny-reactive-height-of-plots/1503/4).

Is there a way to do that from ggplotly() ?

Thanks a lot!

  • https://stackoverflow.com/a/45479034/13440409 – wanderzen Jun 27 '22 at 10:24
  • consider making it fullscreen will be an alternative: https://stackoverflow.com/questions/69042546/is-there-a-way-to-create-a-full-screen-popup-window-of-a-plotly-chart-in-r/69096923#69096923 – lz100 Jun 27 '22 at 21:35
  • Thank you! It seems like there isn't a direct option to create images with dynamic resizing when using `ggplotly()`. I need to embed the figure in a webpage so at this point hacking the final html directly also works. Thanks – Anna Quaglieri Jun 30 '22 at 11:50

0 Answers0