Input selector only updates one dataset in ggplot2

时间:2015-09-14 16:17:04

标签: r ggplot2 shiny-server shiny

I'm having a problem with my Shiny/ggplot app. Here's the situation:

  • The shiny page has only one dropdown input select box
  • The plot uses 2 datasets, one is a geom_segment, the other geom_point
  • The input select box should apply a filter on the datasets (using the same column)
  • When I change the dropdown, only the first dataset is re-filtered

Here's the main section of code that I think needs tinkering:

output$chart <- renderPlot({
  graph2 <- ggplot()
    graph2 + 
    geom_segment(data = subset(segment.data, subset = segment.data$jobLevel == input$level), 
                 aes(x = start.time, y = empID, xend = end.time, yend = empID, color = combined.leave.types),size = 1, alpha = .8) +
    geom_point(data = subset(point.data, subset = point.data$jobLevel == input$level), 
                 aes(x = time.sent, y = empID), size = .8, alpha = .5, inherit.aes = FALSE) + 

The rest of the code is just formatting the plot, I don't believe it's relevant to this issue.

Thanks for any help you can provide!

0 个答案:

没有答案