Stock price display
Now that we have a data frame nested by stock symbol, let's make a Trelliscope display with a plot for each stock. In this exercise, we use just the first 10 stocks in the by_symbol
dataset we created in the previous exercise and create an "open-high-low-close" plot, a plot similar to candlestick plots. The available by_symbol
dataset available in your session has already been subsetted to the first 10 stocks.
Cet exercice fait partie du cours
Visualizing Big Data with Trelliscope in R
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
library(trelliscopejs)
library(dplyr)
library(purrr)
library(plotly)
ohlc_plot <- function(d) {
plot_ly(d, x = ~date, type = "ohlc",
open = ~open, close = ~close,
high = ~high, low = ~low)
}
by_symbol_plot <- by_symbol %>%
mutate(panel = ___(___, ___))