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.
This exercise is part of the course
Visualizing Big Data with Trelliscope in R
Hands-on interactive exercise
Have a go at this exercise by completing this sample 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 = ___(___, ___))