fdPlotly: Create an interactive plot using plotly.

Description Usage Arguments Examples

Description

This function is a lightweight wrapper around plotly.js. For complete documentation, please refer to https://plot.ly/javascript/reference/.

Usage

1
2

Arguments

data

list of traces to plot.

layout

list consisting of the layout to use for the plot.

config

list consisting of configuration to use for the plot.

width

width of the plot.

height

height of the plot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Example 1: Scatterplot
dat <- list(
  x = runif(100),
  y = runif(100),
  mode = 'markers',
  type = 'scatter'
)
layout <- list(margin = list(t = 40))
config <- list(displaylogo = FALSE, displayModeBar = FALSE)

if (interactive()){
  fdPlotly(
    data = list(dat),
    layout = layout,
    config = config,
    height = 325
  )  
}


# Example 2: Line and Scatter Plot
# https://plot.ly/javascript/line-and-scatter/
trace1 = list(
  x =  c(1, 2, 3, 4),
  y =  c(10, 15, 13, 17),
  mode =  'markers',
  type =  'scatter'
)

trace2 = list(
  x =  c(2, 3, 4, 5),
  y =  c(16, 5, 11, 9),
  mode =  'lines',
  type =  'scatter'
)

trace3 = list(
  x =  c(1, 2, 3, 4),
  y =  c(12, 9, 15, 12),
  mode =  'lines+markers',
  type =  'scatter'
)

if (interactive()){
  fdPlotly(
    data = list(trace1, trace2, trace3)
  )
}

alteryx/flightdeck documentation built on May 12, 2019, 1:39 a.m.