gpt4 book ai didi

r - Shiny 的fluid行列空白

转载 作者:行者123 更新时间:2023-12-03 20:03:13 25 4
gpt4 key购买 nike

我有一个顶部横幅,我想分成代表两个不同输入的两个独立部分。为此,我创建了fluidRow并具有两列,每个输入一列。但是,尽管现在,尽管将offset = 0,但列之间仍然有一点空白。是否有任何方法可以删除此空白,以使各列​​紧挨着呢?

colors = c("green","blue","red")
library(shiny)

ui <- fluidPage(

tabsetPanel(
tabPanel("Info",
fluidRow(
column(width = 6, offset = 0,
div(style = "height:50px;width:100%;background-color: #999999;border-style: solid;border-color: #000000",
tags$h3("Section 1")
)
),
column(width = 6, offset = 0,
div(style = "height:50px;width:100%;background-color: #999999;border-style: solid;border-color: #000000",
tags$h3("Section 2")
)
)
),
fluidRow(
column(width = 6, offset = 0,
div(style = "height:50px;width:100%;background-color: #999999;border-style: solid;border-color: #000000",
selectInput(inputId = "color",label = "color:",
choices = colors,
selected = colors[2],
multiple = FALSE)
)
),
column(width = 6, offset = 0,
div(style = "height:50px;width:100%;background-color: #999999;border-style: solid;border-color: #000000",
selectInput(inputId = "points",label = "Number of Points:",
choices = c("30","60","90"),
selected = "10",
multiple = FALSE) )
)
),
br(),
br(),
fluidRow(
actionButton(inputId = "go",
label = "Update"
)
),
fluidRow(
plotOutput("plot", width = "100%")
)

)
)
)


server <- function(input, output,session) {

data = eventReactive(input$go, {
var1 = rnorm(isolate(as.numeric(input$points)),5)
cat1 = c(rep("red",length(var1)/3),rep("blue",length(var1)/3),rep("green",length(var1)/3))
data = cbind.data.frame(var1,cat1)
plotdata = data[which(data$cat1 ==isolate(input$color)),]
}
)

output$plot = renderPlot({
plotdata = data()
plotcol = isolate(input$color)
plot(plotdata$var1, col = plotcol)
})
}

shinyApp(ui = ui,server = server)

最佳答案

空白是div列的填充。要删除它,请使用

column(width = 6, offset = 0, style='padding:0px;', ...)

关于r - Shiny 的fluid行列空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36778316/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com