是否可以使用选择小部件来显示用于反应色选择的调色板?我想让用户选择颜色的情节,是由一个闪亮的应用程序。
发布于 2015-06-22 23:14:20
对于任何来这里寻找颜色选择器的人,使用shinysky的前一个答案已经过时了(来自那里的颜色选择器已经转移到一个没有维护的包中)。
有另一个颜色选择器,可用于发光在星光包。
library(ggplot2)
library(shiny)
library(shinyjs)
runApp(shinyApp(
ui = fluidPage(
colourInput("col", "Select colour", "grey"),
plotOutput("plot")
),
server = function(input, output, session) {
output$plot <- renderPlot({
ggplot(cars, aes(speed, dist)) +
geom_point() +
theme(panel.background = element_rect(fill = input$col))
})
}
))

免责声明:我是这个软件包的作者。
发布于 2014-07-02 11:54:59
shinysky包有一个颜色选择器,可以与shiny一起使用。
require(shinysky)
require(shiny)
runApp(list(
ui = bootstrapPage(
jscolorInput("colorid"),
uiOutput('myPanel'),
plotOutput('plot')
),
server = function(input, output) {
output$myPanel <- renderUI({
mystyle <- ifelse(is.null(input$colorid), "ffffff", input$colorid)
inputPanel(
numericInput('n', 'Number of obs', 100)
, style = paste0("background-color:#", mystyle, ";")
)
})
output$plot <- renderPlot({ hist(runif(input$n)) })
}
))

它目前不在CRAN上,所以您需要通过devtools安装它,详细信息在https://github.com/AnalytixWare/ShinySky上。
https://stackoverflow.com/questions/24530195
复制相似问题