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

interactive graphics
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Interactive graphics

Steve Bagley

somgen223.stanford.edu 1

slide-2
SLIDE 2

plotly

somgen223.stanford.edu 2

slide-3
SLIDE 3

plotly

  • https://plot.ly/r/ is an open-source library for interactive graphics.

somgen223.stanford.edu 3

slide-4
SLIDE 4

graph from ggplot

Grand RapidsDuluth University Farm Morris Crookston Waseca

  • 20
  • 10

10 20 Svansota

  • No. 462

Manchuria

  • No. 475

Velvet Peatland Glabron

  • No. 457

Wisconsin No. 38 Trebi Svansota

  • No. 462

Manchuria

  • No. 475

Velvet Peatland Glabron

  • No. 457

Wisconsin No. 38 Trebi Svansota

  • No. 462

Manchuria

  • No. 475

Velvet Peatland Glabron

  • No. 457

Wisconsin No. 38 Trebi Svansota

  • No. 462

Manchuria

  • No. 475

Velvet Peatland Glabron

  • No. 457

Wisconsin No. 38 Trebi Svansota

  • No. 462

Manchuria

  • No. 475

Velvet Peatland Glabron

  • No. 457

Wisconsin No. 38 Trebi Svansota

  • No. 462

Manchuria

  • No. 475

Velvet Peatland Glabron

  • No. 457

Wisconsin No. 38 Trebi

Difference in yield (1932 vs 1931) Variety of barley

somgen223.stanford.edu 4

slide-5
SLIDE 5

plotly demo

  • See code in this file: plotly_example.r

somgen223.stanford.edu 5

slide-6
SLIDE 6

shiny

somgen223.stanford.edu 6

slide-7
SLIDE 7

shiny demo

somgen223.stanford.edu 7

slide-8
SLIDE 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

slide-9
SLIDE 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

slide-10
SLIDE 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

slide-11
SLIDE 11

shiny demo

  • See code in this file: shiny_example.r

somgen223.stanford.edu 11

slide-12
SLIDE 12

Reading

  • Optional: Plotly R Graphing Library | R | Plotly
  • Optional: Shiny

somgen223.stanford.edu 12