-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample_effect_plotly.R
44 lines (44 loc) · 1.55 KB
/
example_effect_plotly.R
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
#' @examples
#' library(plotly)
#' plot_ly(z, x = ~x, y = ~estimate) |>
#' add_fan(sd = ~sd, text = ~display) |>
#' add_classification(lcl = ~lcl, ucl = ~ucl, threshold = 1) |>
#' layout(
#' hovermode = "x unified",
#' shapes = reference_shape(threshold = 1),
#' annotations = reference_text(threshold = 1)
#' )
#' plot_ly(z, x = ~x, y = ~estimate) |>
#' add_fan(sd = ~sd, step = 0.1, text = ~display) |>
#' add_classification(
#' lcl = ~lcl, ucl = ~ucl, threshold = 1, detailed = FALSE
#' ) |>
#' layout(
#' shapes = reference_shape(threshold = 1, line = TRUE),
#' annotations = reference_text(threshold = 1)
#' )
#' plot_ly(z, x = ~x, y = ~estimate) |>
#' add_fan(sd = ~sd, step = 0.2, hoverinfo = "none") |>
#' add_classification(
#' lcl = ~lcl, ucl = ~ucl, threshold = 1, signed = FALSE
#' ) |>
#' layout(shapes = reference_shape(threshold = 1))
#' plot_ly(z, x = ~x, y = ~estimate) |>
#' add_fan(sd = ~sd, step = 0.3) |>
#' add_classification(
#' lcl = ~lcl, ucl = ~ucl, threshold = 1, detailed = FALSE, signed = FALSE,
#' text = ~display
#' ) |>
#' layout(
#' shapes = reference_shape(threshold = 1, line = TRUE)
#' )
#'
#' # trend
#' plot_ly(data = trend, x = ~year, y = ~index) |>
#' add_fan(sd = ~sd, text = ~display, hoverinfo = "text") |>
#' add_classification(sd = ~sd, threshold = th) |>
#' layout(
#' hovermode = "x unified", hoverdistance = 1,
#' shapes = reference_shape(threshold = th, reference = ref),
#' annotations = reference_text(threshold = th, reference = ref)
#' )