Stock Price Animation – Team 4

1NT23IS065 - Chirantana R. Gowda | 1NT23IS080 - Harsh Deep B Nair

📊 Project Objective

Visualize and analyze time-series stock price data for five major tech companies using animation.

Goals:

  • Understand stock trends over time.
  • Animate the stock prices to visualize dynamics.
  • Compare price movements between companies.

📁 Dataset Used

File: World-Stock-Prices-Dataset.csv

Fields of interest:

  • Date: Daily record
  • Ticker: Stock symbol
  • Close: Closing price
  • Brand_Name: Full company name

🛠️ Libraries Used

```r library(data.table) # Fast file reading
library(dplyr) # Data manipulation
library(ggplot2) # Base plotting
library(gganimate) # Animation support for ggplot
library(gifski) # Renders animations to GIF
library(transformr) # Smooth transitions in gganimate

🧹 Data Preprocessing – Step 1

✅ Dataset Overview

  • The dataset includes daily stock prices for numerous companies worldwide.
  • Key fields: Date, Ticker, Close, Brand_Name.

🧹 Data Preprocessing – Step 2

🔍 Company Selection

  • Filtered for 5 major tech companies:
    • Apple (AAPL)
    • Alphabet (GOOGL)
    • Microsoft (MSFT)
    • Amazon (AMZN)
    • Tesla (TSLA)
  • Focused analysis improves comparison and visual clarity.

🧹 Data Preprocessing – Step 3

🗓️ Date Conversion

  • Converted the Date column from string to Date format.
  • Essential for accurate chronological plotting and animation.

🧹 Data Preprocessing – Step 4

🏷️ Label Creation

  • Created a new Label column:
    "Brand_Name (Ticker)"
  • Improves legend readability in visualizations.

🧹 Data Preprocessing – Step 5

🧽 Final Data Refinement

  • Filtered the dataset to include only selected companies.
  • Result: A clean, focused subset ready for visualization.

📈 Plot Construction – Step 1

🧱 Base Plot Setup

  • X-axis: Date
  • Y-axis: Close (closing stock price)
  • Colored by: Label to distinguish between companies.

📈 Plot Construction – Step 2

✨ Animation Design

  • Used gganimate for smooth transitions over time.
  • Applied transition_reveal(along = Date) to draw lines gradually.
  • Subtitle dynamically shows the current date using {frame_along}.

🎞️ Animation Rendering

🛠️ Rendering to GIF

  • Rendered the animation using gifski_renderer().
  • Output settings:
    • Resolution: 900x550 px
    • Duration: 20 seconds
    • Frame Rate: 25 fps
  • Saved the output as stock_animation.gif.

🖼️ Animated Visualization

📊 Stock Price Movement Over Time

📊 End of Presentation

Thank you!