From 94cab7390ec8ec910811b218b7a21246d8df2175 Mon Sep 17 00:00:00 2001 From: nielsenmarkus11 Date: Mon, 26 Sep 2016 10:49:59 -0600 Subject: [PATCH 1/2] Add `source` argument to both the source plot and `event_data` function The purpose is to avoid error messages if and when someone clicks a point on the scatter plot online at: https://plot.ly/r/shinyapp-linked-click/ --- inst/examples/plotlyLinkedClick/app.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inst/examples/plotlyLinkedClick/app.R b/inst/examples/plotlyLinkedClick/app.R index 3f0af79789..b8613c84f4 100644 --- a/inst/examples/plotlyLinkedClick/app.R +++ b/inst/examples/plotlyLinkedClick/app.R @@ -19,7 +19,7 @@ ui <- fluidPage( server <- function(input, output, session) { output$heat <- renderPlotly({ plot_ly(x = nms, y = nms, z = correlation, - key = correlation, type = "heatmap") %>% + key = correlation, type = "heatmap", source="heatplot") %>% layout(xaxis = list(title = ""), yaxis = list(title = "")) }) @@ -35,7 +35,7 @@ server <- function(input, output, session) { }) output$scatterplot <- renderPlotly({ - s <- event_data("plotly_click") + s <- event_data("plotly_click", source="heatplot") if (length(s)) { vars <- c(s[["x"]], s[["y"]]) d <- setNames(mtcars[vars], c("x", "y")) From a8f96a8e02693936f16abcb0ee855a4c1341951c Mon Sep 17 00:00:00 2001 From: nielsenmarkus11 Date: Mon, 26 Sep 2016 11:03:46 -0600 Subject: [PATCH 2/2] Add spaces around equal signs --- inst/examples/plotlyLinkedClick/app.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inst/examples/plotlyLinkedClick/app.R b/inst/examples/plotlyLinkedClick/app.R index b8613c84f4..b9d72fc4c9 100644 --- a/inst/examples/plotlyLinkedClick/app.R +++ b/inst/examples/plotlyLinkedClick/app.R @@ -19,7 +19,7 @@ ui <- fluidPage( server <- function(input, output, session) { output$heat <- renderPlotly({ plot_ly(x = nms, y = nms, z = correlation, - key = correlation, type = "heatmap", source="heatplot") %>% + key = correlation, type = "heatmap", source = "heatplot") %>% layout(xaxis = list(title = ""), yaxis = list(title = "")) }) @@ -35,7 +35,7 @@ server <- function(input, output, session) { }) output$scatterplot <- renderPlotly({ - s <- event_data("plotly_click", source="heatplot") + s <- event_data("plotly_click", source = "heatplot") if (length(s)) { vars <- c(s[["x"]], s[["y"]]) d <- setNames(mtcars[vars], c("x", "y"))