2023-09-20
There are lots of amazing packages for animation and interactivity like…
For this presentation, I will share examples of -
How do I know this?
Because I watched each episode at 2X speed and diligently noted down every F*bomb and gesture reference!!
FOR SCIENCE!!
dataset |>
plotly::plot_ly(y=~count, x = ~season) |>
add_bars(type="bar")
dataset |>
plotly::plot_ly(y=~count, x = ~season) |>
add_bars(frame = ~Episode, type="bar")
dataset |>
plotly::plot_ly(y=~count, x = ~season) |>
add_bars(type="bar")
dataset |>
plotly::plot_ly(y=~count, x = ~season) |>
add_bars(frame = ~Episode, type="bar") |>
animation_opts(frame = 800, transition = 300)
\[ f-score = {Roy Kent F-bombs / \choose Total F-bombs} * 100 (\%) \]
Season 1 - Total F-bombs: 56
Season 2 - Total F-bombs: 106
Season 3 - Total F-bombs: 138
dataset |>
plotly::plot_ly(y=~F_score, x = ~episode) |>
add_bars(type="bar")
shared_data <- crosstalk::SharedData$new(dataset)
shared_data <- crosstalk::SharedData$new(dataset)
plot <- shared_data |>
plotly::plot_ly(y=~F_score, x = ~episode) |>
add_bars(type="bar")
shared_data <- crosstalk::SharedData$new(dataset)
plot <- shared_data |>
plotly::plot_ly(y=~F_score, x = ~episode) |>
add_bars(type="bar")
checkbox_season <- crosstalk::filter_checkbox(
id = "Season",
label = "Season",
sharedData = shared_data,
group = ~Season
)
shared_data <- crosstalk::SharedData$new(dataset)
plot <- shared_data |>
plotly::plot_ly(y=~F_score, x = ~episode) |>
add_bars(type="bar")
checkbox_season <- crosstalk::filter_checkbox(
id = "Season",
label = "Season",
sharedData = shared_data,
group = ~Season
)
bscols(checkbox_season, plot)
This is just fine… but as Roy Kent said -
shared_data <- crosstalk::SharedData$new(dataset, key=~Dating_Coaching_flag)
shared_data <- crosstalk::SharedData$new(dataset, key=~Dating_Coaching_flag)
plot1 <- shared_data |>
plotly::plot_ly() |>
group_by(Dating_Coaching_flag) |>
summarise(avg.fscore = mean(F_score, na.rm=TRUE)) |>
add_bars(y = ~Dating_Coaching_flag, x = ~avg.fscore, type="bar")
shared_data <- crosstalk::SharedData$new(dataset, key=~Dating_Coaching_flag)
plot1 <- shared_data |>
plotly::plot_ly() |>
group_by(Dating_Coaching_flag) |>
summarise(avg.fscore = mean(F_score, na.rm=TRUE)) |>
add_bars(y = ~Dating_Coaching_flag, x = ~avg.fscore, type="bar")
plot2 <- shared_data |>
plotly::plot_ly(x = ~Episode, y = ~F_count) |>
add_bars(type="bar")
shared_data <- crosstalk::SharedData$new(dataset, key=~Dating_Coaching_flag)
plot1 <- shared_data |>
plotly::plot_ly() |>
group_by(Dating_Coaching_flag) |>
summarise(avg.fscore = mean(F_score, na.rm=TRUE)) |>
add_bars(y = ~Dating_Coaching_flag, x = ~avg.fscore, type="bar")
plot2 <- shared_data |>
plotly::plot_ly(x = ~Episode, y = ~F_count) |>
add_bars(type="bar")
subplot(plot1,plot2)
shared_data <- crosstalk::SharedData$new(dataset, key=~Dating_Coaching_flag)
plot1 <- shared_data |>
plotly::plot_ly() |>
group_by(Dating_Coaching_flag) |>
summarise(avg.fscore = mean(F_score, na.rm=TRUE)) |>
add_bars(y = ~Dating_Coaching_flag, x = ~avg.fscore, type="bar")
plot2 <- shared_data |>
plotly::plot_ly(x = ~Episode, y = ~F_count) |>
add_bars(type="bar")
subplot(plot1,plot2) |>
plotly::highlight(
persistent = TRUE
, on = "plotly_click"
, off = "plotly_doubleclick"
, dynamic = TRUE)
In other words, what not to do!!
Github repository for code
RData package: “richmondway”