侧边栏面板背景变化

时间:2021-06-11 13:18:17

标签: r shiny

我在 sidebarPanel 中有一个维恩图,需要删除图的背景(白色)并添加与 sidebarPanel 相同的 有什么建议么? 代码是这样的

library(shiny)
ui <- fluidPage(
titlePanel("Old Faithful Geyser Data"),
sidebarLayout(
    sidebarPanel(
        sliderInput("bins",
                    "Number of bins:",
                    min = 1,
                    max = 50,
                    value = 30),imageOutput("Vennout")),mainPanel(
       plotOutput("distPlot"))))
    server <- function(input, output) {
    set1 <- paste(rep("word_" , 200) , sample(c(1:1000) , 200 , replace=F) , sep="")
    set2 <- paste(rep("word_" , 200) , sample(c(1:1000) , 200 , replace=F) , sep="")
  output$Vennout <- renderPlot({

   vennplot <-({venn.diagram(
x = list("one" = set1,
  "two" = set2),
filename = NULL,
fill = c("orange", "blue"),
alpha = c(0.5,0.5),
label.col = "black",
cat.col = c("cornflowerblue", "pink"),
cat.default.pos = "text",
scaled = FALSE
    )})        grid.newpage()
        grid.draw(vennplot)})}
       shinyApp(ui = ui, server = server)

1 个答案:

答案 0 :(得分:1)

设置线条和填充的颜色以匹配亮灰色 - #F5F5F5:

grid.newpage()
grid.draw(rectGrob(gp = gpar(col = "#F5F5F5", fill = "#F5F5F5")))
grid.draw(vennplot)

enter image description here