The Fall of Silicon Valley Bank
March 10, 2023
I imagine that the fall of Silicon Valley Bank caught many of us by surprise.
At the time of this writing, there’s a whole lot of uncertainty about what that means for many of us in the technology space.
In the meantime, here’s a cat.
library(tidyverse)
library(gganimate)
library(ggcats) # remotes::install_github("R-CoderDotCom/ggcats@main")
library(hrbrthemes)
library(tidyquant)
library(gifski)
symbol <- "SIVB"
stock <- tidyquant::tq_get(symbol, get = "stock.prices", from = "2021-10-01", to = "2023-03-10")
head(stock)
## # A tibble: 6 × 8
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 SIVB 2021-10-01 650 670. 648. 665. 281100 665.
## 2 SIVB 2021-10-04 664. 669 646. 649. 340700 649.
## 3 SIVB 2021-10-05 658. 669. 652. 665. 358700 665.
## 4 SIVB 2021-10-06 654. 664. 643. 660. 441200 660.
## 5 SIVB 2021-10-07 671. 679 663. 666. 258700 666.
## 6 SIVB 2021-10-08 671. 671. 663. 670. 316500 670.
stock_anim_cat <- stock %>%
ggplot(aes(x = date, y = close)) +
geom_line(size = 2) +
geom_cat(aes(cat = "pop"), size = 4) + # I was hoping to use the cat_col, but something's wonky
scale_x_date(date_breaks = "1 month", date_labels = "%b\n%y", expand = c(0,0)) +
scale_y_continuous(breaks = seq(0,800,50), limits = c(0,800), expand = c(0,0)) +
theme_ipsum_rc() +
labs(
title = sprintf("The Fall of Silicon Valley Bank", symbol),
x = "Date",
y = "Closing Price",
caption = "kwanlin.com"
) +
transition_reveal(date)
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## Warning in sprintf("The Fall of Silicon Valley Bank", symbol): one argument not
## used by format 'The Fall of Silicon Valley Bank'
animate(stock_anim_cat, duration = 10, fps = 20, width = 800, height = 800, renderer = gifski_renderer())
anim_save("output.gif")