Using ggplot2 3.0.0 and shiny: nearPoints() problem



Back in the ggplot2 2.2.1 days, the nearPoints() function in shiny could automatically infer xvar and yvar in ggplot2. This made it great when passing different dataframes to the same reactive function.

Since ggplot2 3.0.0, this automatic mapping identification simply does not work. The Error: Data has ### rows, replacement has 0. I suspect this has to do with the tidyverse changes. Does anyone know how to properly construct ggplot() under ggplot2 3.0.0 to properly identify xvar and yvar without explicitly referencing them? Or has this functionality been permanently removed?


I think it should work if you use the latest development version of shiny. You can install it with:


If you still have problems, can you file an issue on the Shiny issue tracker?