This shiny application used plots two variables from Mtcars data set You can see the plot in the plot panel using cyl as colors.
Sofian Hamiti
This shiny application used plots two variables from Mtcars data set You can see the plot in the plot panel using cyl as colors.
library(shiny)
## Warning: package 'shiny' was built under R version 3.2.1
library(ggvis)
## Warning: package 'ggvis' was built under R version 3.2.1
library(httr)
shinyServer(
function(input, output) {
# A reactive expression wrapper for input$size
input_am <- reactive(input$am)
input_size <- reactive(input$size)
input_span <- reactive(input$span)
input_opacity <- reactive(input$opacity)
mtcars %>%
ggvis(~mpg, ~hp) %>%
group_by(cyl) %>%
layer_points(size := input_size, opacity := input_opacity, fill = ~cyl) %>%
layer_smooths(span = input_span, fill = ~cyl, se=TRUE) %>%
bind_shiny("ggvis", "ggvis_ui")
})
library(shiny)
library(ggvis)
shinyUI(fluidPage(
# Application title
titlePanel("Mtcars"),
# Sidebar layout
sidebarLayout(
# Sidebar panel
sidebarPanel(
sliderInput("size", "Area", 10, 1000, value = 100),
sliderInput('span', "Span", 0.5, 1, value = 0.75),
sliderInput('opacity', "Point Opacity", 0, 1, value = 0.5)),
# Main panel
mainPanel(
uiOutput("ggvis_ui"),
ggvisOutput("ggvis")))))
<!--html_preserve-->
shinyapps.io: http://sofianhamiti.shinyapps.io/mtcars