side-by-side eulerr diagram label cut off in shiny app

Hello,

Does anyone know how to plot side-by-side euler diagram (from eulerr package) in shiny app without having the label cut off?

Below is a simple code that plot side-by-side euler diagram but the labels are cut off.

library(shiny)
library(eulerr)
library(gridExtra)
library(ggplot2)
library("grid")
library("ggplotify")

# Define UI for app that draws a histogram ----
ui <- fluidPage(
  fluidRow(
   plotOutput("euler"))
  )

server <- function(input, output,session) {
  fit <- euler(c("Lalalalala" = 376, "B" = 509, "Lalalalala&B" = 3983))
  p<- plot(fit,quantities = list(type=c("counts","percent")))
  output$euler <- renderPlot(
    grid.arrange(p,p,ncol=2)
    )
  
}

shinyApp(ui, server)

I accidentally found the solution. I'm posting it here in case other people have similar problem.

All you need to do is add padding and specify empty top, bottom, right, left arguments in grid.arrange.

output$euler <- renderPlot(
    grid.arrange(p,p,ncol=2,padding=unit(5,"line"),top="",bottom="",right="",left="")
  )

image

2 Likes

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.