我想让 geom_col 的边框透明。它仅在使用 ggplot2 时有效:
library(ggplot2)
dataToPlot <- data.frame(Freq = c(0.0000000, 0.7092199, 1.4184397, 2.1276596, 2.8368794),
variable = rep('A',5), value = c(43089.76, 62923.17, 35446.15, 29553.76, 22433.08))
p <- ggplot( dataToPlot , aes(x=Freq, y = value, group = variable ) ) + #
# geom_bar(stat = "bin") fill = variable,
geom_col( mapping = aes(col = variable, fill = variable), colour = F, alpha = 0.2, orientation = "x", position = "dodge") +
# scale_linetype(aes(linetype = 0))
guides(color = FALSE)
dev.new(); p
但是,带有闪亮的完全相同的代码给出了错误:“错误:无效的颜色名称'FALSE'”
library(ggplot2)
library(shiny)
dataToPlot <- data.frame(Freq = c(0.0000000, 0.7092199, 1.4184397, 2.1276596, 2.8368794),
variable = rep('A',5), value = c(43089.76, 62923.17, 35446.15, 29553.76, 22433.08))
ui <- fluidPage(
useShinyjs(),
fluidRow(
column(8,
plotOutput("plot")
)
)
)
server <- function(input, output) {
output$plot <- renderPlotly({
p <- ggplot( dataToPlot , aes(x=Freq, y = value, group = variable ) ) + #
# geom_bar(stat = "bin") fill = variable,
geom_col( mapping = aes(col = variable, fill = variable), colour = F, alpha = 0.2, orientation = "x", position = "dodge") +
# scale_linetype(aes(linetype = 0))
guides(color = FALSE)
})
}
shinyApp(ui,server)
我究竟做错了什么?