This presentation uses the built-in dataset of beaver1.
Beaver1 contains the body temperatures of a beaver measured every 10 minutes.
Beaver1 also records the active status.
The purpose is to highlight the temperature that the beaver is active.
July 9, 2017
This presentation uses the built-in dataset of beaver1.
Beaver1 contains the body temperatures of a beaver measured every 10 minutes.
Beaver1 also records the active status.
The purpose is to highlight the temperature that the beaver is active.
beaver1$activ <- factor(beaver1$activ) str(beaver1)
'data.frame': 114 obs. of 4 variables: $ day : num 346 346 346 346 346 346 346 346 346 346 ... $ time : num 840 850 900 910 920 930 940 950 1000 1010 ... $ temp : num 36.3 36.3 36.4 36.4 36.5 ... $ activ: Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
library(plotly) color <- ifelse(beaver1$activ == 1, "red", "green") size <- ifelse(beaver1$activ == 1, 1.2, 1)
plot_ly(beaver1, x= ~time(time), y = ~temp, size = size, type = "scatter",
mode = "marker", marker = list(color = color))