【发布时间】:2021-02-20 22:19:42
【问题描述】:
我有一个关于 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,不可能添加形状。所以我想我把它改成geom_point,但是如果我这样做并添加形状并保持填充和颜色相同,那么填充会变成黑色(AccesEnergie)。见添加的图片。为什么会这样,有人可以帮帮我吗?
【问题讨论】:
-
如果您创建一个小的可重现示例以及预期的输出,这将更容易提供帮助。阅读how to give a reproducible example。
-
谢谢,此时我希望人们有足够的信息来帮助我。部分数据是机密的。
-
请注意,您可以发布虚拟数据。例如,可以使用 apple、orange 等代替实名。此外,变量名可以修改为 var1、var2 等。
标签: r shiny geom-col geom-point