New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plotOutput UI options don't work with ggplot2 3.0 #2173
Comments
|
@leedrake5 With cran shiny and cran ggplot2 and the example below, I do not observe the behavior. (Inspired and reduced from 105-plot-interaction-zoom) Do you have a small example app that I could try to reproduce with on my end? Thank you in advance! -Barret source("zoom.R")# zoom.R
install.packages(c("shiny", "ggplot2"))
library(shiny)
library(ggplot2)
ui <- fluidPage(
fluidRow(
column(width = 4, class = "well",
h4("Brush and double-click to zoom"),
plotOutput("plot1", height = 300,
dblclick = "plot1_dblclick",
brush = brushOpts(
id = "plot1_brush",
resetOnNew = TRUE
)
)
)
)
)
server <- function(input, output) {
# -------------------------------------------------------------------
# Single zoomable plot (on left)
ranges <- reactiveValues(x = NULL, y = NULL)
dt <- data.frame(x = runif(100), y = runif(100))
output$plot1 <- renderPlot({
ggplot(dt, aes(x, y)) + geom_point() +
coord_cartesian(xlim = ranges$x, ylim = ranges$y, expand = FALSE)
})
# When a double-click happens, check if there's a brush on the plot.
# If so, zoom to the brush bounds; if not, reset the zoom.
observeEvent(input$plot1_dblclick, {
brush <- input$plot1_brush
if (!is.null(brush)) {
ranges$x <- c(brush$xmin, brush$xmax)
ranges$y <- c(brush$ymin, brush$ymax)
} else {
ranges$x <- NULL
ranges$y <- NULL
}
})
}
shinyApp(ui, server) |
|
Hi @leedrake5, sorry to bug you but would it be possible for you to provide a little more information (best of all would be a reproducible example)? We're trying to close out the bug fixing period for Shiny v1.2 this week, and if there's a real issue here we would definitely want to fix it. Also it'd be helpful to know whether you install ggplot2 3.0.0 from CRAN or from GitHub ( Thanks! |
|
Hi Joe,
Thanks for reaching out. I'm on a business trip, but will be back in my
office tomorrow and will provide more details.
Thanks,
…---
B. Lee Drake
Department of Anthropology
University of New Mexico
(505) 510.1518
b.lee.drake@gmail.com
[image: LinkedIn] <http://www.linkedin.com/pub/lee-drake/13/963/23a> [image:
Facebook] <http://www.facebook.com/Thalesian> [image: Google]
<http://www.google.com/profiles/Thalesian> [image: Twitter]
<http://www.twitter.com/BLeeDrake> [image: Scribd]
<http://unm.academia.edu/BrandonDrake>
On Tue, Sep 18, 2018 at 2:45 PM Joe Cheng ***@***.***> wrote:
Hi @leedrake5 <https://github.com/leedrake5>, sorry to bug you but would
it be possible for you to provide a little more information (best of all
would be a reproducible example)? We're trying to close out the bug fixing
period for Shiny v1.2 this week, and if there's a real issue here we would
definitely want to fix it. Also it'd be helpful to know whether you install
ggplot2 3.0.0 from CRAN or from GitHub (devtools::session_info() will
tell you the exact commit ID in the latter case).
Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2173 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABLC5soPJaYPl9CqGQSvUw0qqSgkqzVmks5ucVtegaJpZM4WZqn9>
.
|
|
Thanks @leedrake5, that would be much appreciated. |
|
Hi all,
Happy to report that on reloading ggplot 3.0, it is working perfectly fine
with shiny for the first time in months with shiny 1.1.0. I didn't change
my base code. I wonder if it is an update in another package. Either way,
consider this issue closed. Thank you for reaching out.
Thanks,
…---
B. Lee Drake
Department of Anthropology
University of New Mexico
(505) 510.1518
b.lee.drake@gmail.com
[image: LinkedIn] <http://www.linkedin.com/pub/lee-drake/13/963/23a> [image:
Facebook] <http://www.facebook.com/Thalesian> [image: Google]
<http://www.google.com/profiles/Thalesian> [image: Twitter]
<http://www.twitter.com/BLeeDrake> [image: Scribd]
<http://unm.academia.edu/BrandonDrake>
On Tue, Sep 18, 2018 at 6:08 PM Joe Cheng ***@***.***> wrote:
Thanks @leedrake5 <https://github.com/leedrake5>, that would be much
appreciated.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2173 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABLC5g9-Uq6q3lM6Nmz4xMYgHUyARjfAks5ucYr2gaJpZM4WZqn9>
.
|
With ggplot2 2.2.1, it was straightforward to get interactivity with a plot. nearPoints, brush, plot clicks, and other features worked quite well. With ggplot2 3.0, however, the normal functionality no longer works. There are two manifestations of this so far:
If I am missing anything let me know, but it strikes me that the changes to ggplot2 3.0 to align it within the tidyverse have broken the way shiny access its data. This manifests as failing to read xvar and yvar in nearPoints, as well as plot interactivity defaulting to the pixels of the plot instead of its data.
Thanks for building such a fantastic package, I hope these comments are helpful in future updates to shiny.
The text was updated successfully, but these errors were encountered: