@@ -58,34 +58,8 @@ fig <- fig %>% layout(xaxis = list(title = 'Displacement (cu.in.)'),
58
58
fig
59
59
```
60
60
61
- ### Loess Smoother with Uncertainty Bounds
62
-
63
- ``` {r}
64
- library(plotly)
65
- library(broom)
66
-
67
- m <- loess(mpg ~ disp, data = mtcars)
68
-
69
- fig <- plot_ly(mtcars, x = ~disp, color = I("black"))
70
- fig <- fig %>% add_markers(y = ~mpg, text = rownames(mtcars), showlegend = FALSE)
71
- fig <- fig %>% add_lines(y = ~fitted(loess(mpg ~ disp)),
72
- line = list(color = 'rgba(7, 164, 181, 1)'),
73
- name = "Loess Smoother")
74
- fig <- fig %>% add_ribbons(data = augment(m),
75
- ymin = ~.fitted - 1.96 * .se.fit,
76
- ymax = ~.fitted + 1.96 * .se.fit,
77
- line = list(color = 'rgba(7, 164, 181, 0.05)'),
78
- fillcolor = 'rgba(7, 164, 181, 0.2)',
79
- name = "Standard Error")
80
- fig <- fig %>% layout(xaxis = list(title = 'Displacement (cu.in.)'),
81
- yaxis = list(title = 'Miles/(US) gallon'),
82
- legend = list(x = 0.80, y = 0.90))
83
-
84
- fig
85
- ```
86
-
87
61
88
62
89
63
#Reference
90
64
91
- See [ https://plotly.com/r/reference/ ] ( https://plotly.com/r/reference/ ) for more information and chart attribute options!
65
+ See [ https://plotly.com/r/reference/ ] ( https://plotly.com/r/reference/ ) for more information and chart attribute options!
0 commit comments