Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bdf4f28

Browse files
author
mahdis-z
committed
fix ci
1 parent 8e18a9c commit bdf4f28

File tree

1 file changed

+36
-39
lines changed

1 file changed

+36
-39
lines changed

r/2017-05-28-cumulative-animations.Rmd

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ accumulate_by <- function(dat, var) {
3535
}
3636
3737
d <- txhousing
38-
fig <- fig %>%
38+
fig <- d %>%
3939
filter(year > 2005, city %in% c("Abilene", "Bay Area"))
40-
fig <- d %>% accumulate_by(~date)
40+
fig <- fig %>% accumulate_by(~date)
4141
4242
4343
fig <- fig %>%
@@ -73,6 +73,7 @@ fig <- fig %>% animation_button(
7373
)
7474
7575
fig
76+
7677
```
7778

7879
### Filled-Area Animation
@@ -96,48 +97,44 @@ accumulate_by <- function(dat, var) {
9697
dplyr::bind_rows(dats)
9798
}
9899
99-
df <- df
100-
fig <- fig %>%
101-
accumulate_by(~ID)
102-
103-
fig <- df
100+
fig <- df %>% accumulate_by(~ID)
104101
fig <- fig %>% plot_ly(
105-
x = ~ID,
106-
y = ~AAPL.Close,
107-
frame = ~frame,
108-
type = 'scatter',
109-
mode = 'lines',
110-
fill = 'tozeroy',
111-
fillcolor='rgba(114, 186, 59, 0.5)',
112-
line = list(color = 'rgb(114, 186, 59)'),
113-
text = ~paste("Day: ", ID, "<br>Close: $", AAPL.Close),
114-
hoverinfo = 'text'
115-
)
102+
x = ~ID,
103+
y = ~AAPL.Close,
104+
frame = ~frame,
105+
type = 'scatter',
106+
mode = 'lines',
107+
fill = 'tozeroy',
108+
fillcolor='rgba(114, 186, 59, 0.5)',
109+
line = list(color = 'rgb(114, 186, 59)'),
110+
text = ~paste("Day: ", ID, "<br>Close: $", AAPL.Close),
111+
hoverinfo = 'text'
112+
)
116113
fig <- fig %>% layout(
117-
title = "AAPL: Last 30 days",
118-
yaxis = list(
119-
title = "Close",
120-
range = c(0,250),
121-
zeroline = F,
122-
tickprefix = "$"
123-
),
124-
xaxis = list(
125-
title = "Day",
126-
range = c(0,30),
127-
zeroline = F,
128-
showgrid = F
129-
)
130-
)
131-
fig <- fig %>% animation_opts(
132-
frame = 100,
133-
transition = 0,
134-
redraw = FALSE
114+
title = "AAPL: Last 30 days",
115+
yaxis = list(
116+
title = "Close",
117+
range = c(0,250),
118+
zeroline = F,
119+
tickprefix = "$"
120+
),
121+
xaxis = list(
122+
title = "Day",
123+
range = c(0,30),
124+
zeroline = F,
125+
showgrid = F
135126
)
127+
)
128+
fig <- fig %>% animation_opts(
129+
frame = 100,
130+
transition = 0,
131+
redraw = FALSE
132+
)
136133
fig <- fig %>% animation_slider(
137-
currentvalue = list(
138-
prefix = "Day "
139-
)
134+
currentvalue = list(
135+
prefix = "Day "
140136
)
137+
)
141138
142139
fig
143140
```

0 commit comments

Comments
 (0)