I have an application depicting data on public financing, and the user can generate a pdf report of the data. This Shiny app is developed locally and is deployed onto a Shiny Server running ubuntu 16.04.
The code is fully operational in the sense that the code produces a .pdf, however in the server-side application (running the exact same code), excessive margins are applied onto the plots. See screenshots below;
SERVER output (excessive margins):
Both the server and my local development computer are runnning knitr 1.20 and rmarkdown 1.10. Hence, I fail to see how this margin is added considering that I am running unconfigured, same versions of the two respective libraries across my local computer and the server.
Below is the relevant code chunk of the .Rmd file sourced by Shiny to render the pdf-file:
```{r, echo = FALSE, warning = FALSE, fig.width = 8, fig.height = 3, fig.align='center'}
# mat = params$mat
mat = data.frame(
Allocation = sample(100:200, size = 10, replace = TRUE),
Type = sample(c('Private', 'SME', 'Property'), size = 10, replace = TRUE),
Platform = sample(c('A', 'B', 'C'), size = 10, replace = TRUE)
)
p1 = plot_ly(data = mat, labels = ~Type, values = ~Allocation, type = 'pie', hole = 0.5, name = 'Type',
textinfo = 'label+percent', textposition = 'outside', outsidetextfont = list(color = 'cornflowerblue', size = 6),
domain = list(x = c(0.05, 0.45), y = c(0.05, 0.95))) %>% layout(autoexpand = FALSE)
p2 = plot_ly(data = mat, labels = ~Platform, values = ~Allocation, type = 'pie', hole = 0.5, name = 'Platform',
textinfo = 'label+percent', textposition = 'outside', outsidetextfont = list(color = 'cornflowerblue', size = 6),
domain = list(x = c(0.55, 0.95), y = c(0.05, 0.95))) %>% layout(autoexpand = FALSE)
p = subplot(p1,p2) %>% layout(showlegend = FALSE, autoexpand = FALSE) %>% plotly::config(displayModeBar = F)
p
I have played around with the standard par(oma, mar) functions and plot_ly arguments to no avail, but regardless I doubt the solution to this lies in the code chunk considering that I observe the desirable output locally.
If anyone could share advice, that would be highly appreciated. JG