Skip to content

Instantly share code, notes, and snippets.

@haozhu233
Created September 28, 2015 19:56
Show Gist options
  • Save haozhu233/d9ed184f4c08269a07cd to your computer and use it in GitHub Desktop.
Save haozhu233/d9ed184f4c08269a07cd to your computer and use it in GitHub Desktop.
reproducible bug case for ggvis
library(dplyr)
library(ggvis)
library(shiny)
shinyServer(function(input, output, session) {
session$onSessionEnded(function() {
stopApp()
})
mtcars$cyl <- factor(mtcars$cyl, levels = c(4L,6L, 8L))
reactive({
mtcars %>%
group_by(cyl) %>%
ggvis(~wt, ~mpg) %>%
group_by(cyl) %>%
layer_points(fill = ~cyl, size := 12) %>%
set_options(width = "auto", height = "200px", resizable=FALSE)
}) %>% bind_shiny("plot1")
reactive({
mtcars %>%
group_by(cyl) %>%
ggvis(~wt, ~hp) %>%
group_by(cyl) %>%
layer_points(fill = ~cyl, size := 12) %>%
set_options(width = "auto", height = "200px", resizable=FALSE)
}) %>% bind_shiny("plot2")
})
library(dplyr)
library(ggvis)
library(shiny)
shinyUI(
navbarPage("Demo",
position = "static-top",
fluid = F,
tabPanel("Demo",class="active",
sidebarLayout(
sidebarPanel(
ggvisOutput("plot1"),
ggvisOutput("plot2")
),
mainPanel()
))
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment