Skip to content

Instantly share code, notes, and snippets.

@ClintWeathers
Created November 21, 2015 21:02
Show Gist options
  • Save ClintWeathers/85b9fa3a16be5458dcd6 to your computer and use it in GitHub Desktop.
Save ClintWeathers/85b9fa3a16be5458dcd6 to your computer and use it in GitHub Desktop.
fill + opacity in layer_densities() causes crash in ggvis
# Started from here, an example from Hadley Wickham in the google groups https://groups.google.com/forum/#!topic/ggvis/AJZCdjFcNaE.
# Using R 3.2.1 x86_64, ggvis 0.4.2.
cocaine %>%
ggvis( ~ potency, ~ price) %>%
filter(state %in% eval(input_checkboxgroup(c("IA", "MN", "WI"),
selected = "WI"))) %>%
layer_points(fill = ~ state, size := 50, opacity := 0.5)
# This works fine and evals the way one would expect.
# I changed to densities:
cocaine %>%
ggvis( ~ potency, ~ price) %>%
filter(state %in% eval(input_checkboxgroup(c("IA", "MN", "WI"),
selected = "WI"))) %>%
layer_densities(fill = ~ state, opacity := 0.5)
This vis starts up fine, displays the checkboxes, etc.
However, when I try to add/change the state, the whole vis crashes.
and throws this error message:
"Warning: Unhandled error in observer: object 'state' not found
observe({
data_reactive <- data_table[[data_name]]
session$sendCustomMessage("ggvis_data", list(plotId = id,
name = data_name, value = as.vega(data_reactive(), data_name)))
})
Warning: Unhandled error in observer: object 'state' not found
observe({
data_reactive <- data_table[[data_name]]
session$sendCustomMessage("ggvis_data", list(plotId = id,
name = data_name, value = as.vega(data_reactive(), data_name)))
})
Warning: Unhandled error in observer: object 'state' not found
observe({
for (name in names(data_table)) {
data_table[[name]]()
}
session$sendCustomMessage("ggvis_command", list(plotId = id,
command = "update"))
})
ERROR: [on_request_read] connection reset by peer"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment