ggplot2 geom_col与geom_point的fill、color使用及Shiny显示异常问题
关于geom_point的映射异常问题
我有一个关于geom_point使用的问题:
ui <- fluidPage( titlePanel("Test"), sidebarLayout(sidebarPanel( selectInput( "selectedColX", "Select colum for X axis", choices = c("tooling1","tooling2"), selected = "tooling1" ), selectInput( "selectedfill", "Energie X is vulling", choices = c("tooling1Energie","tooling2Energie"), selected = "tooling1Energie" ), selectInput( "selectedColY", "Select colum for Y axis", choices = c("subject1","subject2"), selected = "subject1" ), selectInput( "selectedcolor", "Energie Y is omlijning", choices = c("subject1Energie","subject2Energie"), selected = "subject1Energie" ) ), mainPanel(plotOutput("distPlot")) ) server <- function(input, output) { output$distPlot <- renderPlot({ x_axis <- input$selectedColX y_axis <- input$selectedColY fill <- input$selectedfill color <- input$selectedcolor gg <- ggplot(KEK, aes_string(x = x_axis, y = y_axis, fill = fill, col = color)) gg <- gg + geom_col(size = 1.5) + facet_wrap(~anoniem) gg }) }
使用上述代码可获得直观的数据洞察,但geom_col图层无法添加形状(shape)映射,因此尝试将图层切换为geom_point,在新增shape参数且保持原有fill、col映射逻辑不变的情况下,fill维度的映射结果变为黑色(对应AccesEnergie),具体效果可参考附带的对比图。请问出现该现象的原因是什么,应如何解决?


内容的提问来源于stack exchange,提问作者Steffie Szegedi
相关产品推荐
相关产品推荐

