text: ---
  title: "manipulateWidget Demo"
  output: html_document
  runtime: shiny
  ---
  
  Hodor. Hodor hodor... Hodor hodor hodor hodor. Hodor, hodor. Hodor. Hodor, hodor, hodor. Hodor hodor?! Hodor, hodor. Hodor. Hodor, hodor - hodor hodor! Hodor, hodor, hodor. Hodor hodor hodor. Hodor. Hodor hodor - hodor... Hodor hodor hodor hodor; hodor hodor? Hodor. Hodor HODOR hodor, hodor hodor... Hodor hodor hodor; hodor hodor?! Hodor hodor - hodor hodor; hodor hodor; hodor hodor? Hodor hodor - hodor hodor... Hodor hodor hodor hodor. Hodor. Hodor hodor HODOR! Hodor HODOR hodor, hodor hodor - hodor hodor! Hodor hodor HODOR! Hodor hodor, hodor. Hodor hodor; hodor hodor; hodor hodor - hodor, hodor, hodor hodor. 
  
  ```{r, echo = FALSE, message = FALSE}
  library(plotly)
  library(manipulateWidget)
  mydata <- data.frame(x = 1:100, y = rnorm(100))
  
  myPlot <- function(type, lwd) {
    if (type == "points") {
      plot_ly(mydata, x= ~x, y = ~y, type = "scatter", mode = "markers")
    } else {
      plot_ly(mydata, x= ~x, y = ~y, type = "scatter", mode = "lines", 
              line = list(width = lwd))
    }
  }
  
  manipulateWidget(
    myPlot(type, lwd),
    type = mwSelect(c("points", "lines"), "points"),
    lwd = mwSlider(1, 10, 1, .display = type == "lines"),
    .height = 600
  )
  ```
  
  Hodor. Hodor hodor... Hodor hodor hodor hodor. Hodor, hodor. Hodor. Hodor, hodor, hodor. Hodor hodor?! Hodor, hodor. Hodor. Hodor, hodor - hodor hodor! Hodor, hodor, hodor. Hodor hodor hodor. Hodor. Hodor hodor - hodor... Hodor hodor hodor hodor; hodor hodor? Hodor. Hodor HODOR hodor, hodor hodor... Hodor hodor hodor; hodor hodor?! Hodor hodor - hodor hodor; hodor hodor; hodor hodor? Hodor hodor - hodor hodor... Hodor hodor hodor hodor. Hodor. Hodor hodor HODOR! Hodor HODOR hodor, hodor hodor - hodor hodor! Hodor hodor HODOR! Hodor hodor, hodor. Hodor hodor; hodor hodor; hodor hodor - hodor, hodor, hodor hodor. 
  
  ```{r, echo = FALSE, message = FALSE}
  library(plotly)
  library(manipulateWidget)
  mydata <- data.frame(x = 1:100, y = rnorm(100))
  
  myPlot <- function(type, lwd) {
    if (type == "points") {
      plot_ly(mydata, x= ~x, y = ~y, type = "scatter", mode = "markers")
    } else {
      plot_ly(mydata, x= ~x, y = ~y, type = "scatter", mode = "lines", 
              line = list(width = lwd))
    }
  }
  
  manipulateWidget(
    myPlot(type, lwd),
    type = mwSelect(c("points", "lines"), "points"),
    lwd = mwSlider(1, 10, 1, .display = type == "lines"),
    .height = 600
  )
  ```
  