1
考虑以下有光泽应用程式:有条件颜色在Plotly单杆,其中R闪亮
UI
library(shiny)
library(plotly)
ui <- fluidPage(
titlePanel("Random Number Generator"),
mainPanel(
plotlyOutput("random_numbers")
)
)
SERVER
server <- function(input, output) {
df <- reactive({
runif(100)
})
output$random_numbers <- renderPlotly({
plot_ly() %>%
add_trace(y = sort(df()),
type = 'bar',
name = 'Random Numbers',
marker = list(color = 'green')) %>%
add_trace(y = mean(df()),
type = 'bar',
name = 'Mean',
marker = list(color = 'orange'))
})
}
输出看起来像这样:
问题
有没有一种方法,我可以显示在相同的顺序其他runif(100)相同的跟踪平均值,这样我可以保持升序排列,并保持平均不同的颜色?我希望它看起来像下图:
打我吧:) –
比赛仍然在,因为在它的错误:d – BigDataScientist
是的,但我有工作要做 - 所以它是你的。不知道你做了阴谋:) –