0

I use saveWidget function in htmlwidgets to save HTML widgets in R. This worked fine. Since I want to reduce the browser padding to 0, I changed it by adding

fig.g <- fig.g %>%
sizingPolicy(browser.padding = 0)

I don't get an error message at this point. However, when I try to save the changed widget, I get the following message:

Error in .getNamespace(pkg) : invalid type/length (symbol/0) in vector allocation

Whitout the change to sizingPolicy, the saving works just fine.

Here my full code:

ggiris <- qplot(Petal.Width, Sepal.Length, data = iris, color = Species)
fig.g <- ggplotly(ggiris)

fig.g <- fig.g %>%
  sizingPolicy(browser.padding = 0)

saveWidget(fig.g, "J:/test.html", selfcontained = T, libdir = "test")

Has it something to do with how I change the sizingPolicy?

an_ja
  • 427
  • 2
  • 13

1 Answers1

0

I managed to do it by using

fig.g.2 <- plotly_build(fig.g)
fig.g.2$sizingPolicy$browser$padding <- 0
an_ja
  • 427
  • 2
  • 13