interactive graphics
play

Interactive graphics Steve Bagley somgen223.stanford.edu 1 plotly - PowerPoint PPT Presentation

Interactive graphics Steve Bagley somgen223.stanford.edu 1 plotly somgen223.stanford.edu 2 plotly https://plot.ly/r/ is an open-source library for interactive graphics. somgen223.stanford.edu 3 graph from ggplot Grand Rapids Duluth


  1. Interactive graphics Steve Bagley somgen223.stanford.edu 1

  2. plotly somgen223.stanford.edu 2

  3. plotly • https://plot.ly/r/ is an open-source library for interactive graphics. somgen223.stanford.edu 3

  4. graph from ggplot Grand Rapids Duluth Trebi Wisconsin No. 38 No. 457 Glabron Peatland Velvet No. 475 Manchuria No. 462 Svansota Trebi Wisconsin No. 38 No. 457 Glabron Peatland Velvet No. 475 Manchuria No. 462 University Farm Svansota Variety of barley Trebi Wisconsin No. 38 No. 457 Glabron Peatland Velvet No. 475 Manchuria No. 462 Svansota Trebi Wisconsin No. 38 No. 457 Morris Crookston Waseca Glabron Peatland Velvet No. 475 Manchuria No. 462 Svansota Trebi Wisconsin No. 38 No. 457 Glabron Peatland Velvet No. 475 Manchuria No. 462 Svansota Trebi Wisconsin No. 38 No. 457 Glabron Peatland Velvet No. 475 Manchuria No. 462 Svansota -20 -10 0 10 20 Difference in yield (1932 vs 1931) somgen223.stanford.edu 4

  5. plotly demo • See code in this file: plotly_example.r somgen223.stanford.edu 5

  6. shiny somgen223.stanford.edu 6

  7. shiny demo somgen223.stanford.edu 7

  8. Main structure of shiny • ui: defines the user interface, the structure of the graphical elements on the page. • server: contains R code that connects changes in the user interface elements to the calculation of new elements to be displayed. somgen223.stanford.edu 8

  9. User interface • The ui is a nested collection of functions that build HTML representations of graphical elements on the page. • Examples: • headers (text) • areas for graphs • control widgets (boxes for text/numeric entry, slider, checkbox, tabs) • These elements are also named, so that the server function can refer to them. somgen223.stanford.edu 9

  10. Server • The server function takes two arguments: input and output . • input contains elements that are set by the user of the webpage. These elements use the names from the ui. • output contains elements that will be updated when the server function is fun. • There is a lot of complex processing (behind the scenes) to make sure that the server function only runs when some part of the input changes. This is called “reactive output”. somgen223.stanford.edu 10

  11. shiny demo • See code in this file: shiny_example.r somgen223.stanford.edu 11

  12. Reading • Optional: Plotly R Graphing Library | R | Plotly • Optional: Shiny somgen223.stanford.edu 12

Recommend


More recommend