BUMP CHART FOR RANKING CHANGES OF TOP COMPANIES [LA 1 ASSIGNMENT]

PRACHETAN MS [USN:1NT24IS152 SEC:‘C’] AND JAYANTH Y [USN:1NT24IS094 SEC: ‘B’]

Objective

  • To generate a bump chart using ggplot2
  • To visualize ranking changes of top companies
  • Based on revenue over multiple years

Step 1: Load Required Packages

  • We use:
    • ggplot2 → visualization
    • dplyr, tidyr → data manipulation

Step 2: Load the Dataset

Dataset: Top US Tech Companies (2022–2023) Inspect structure and preview data

           Company.Name   Industry                  Sector   HQ.State
1            Apple Inc. Technology    Consumer Electronics California
2 Microsoft Corporation Technology Software Infrastructure Washington
3     Alphabet (Google) Technology Software Infrastructure California
4                Amazon Technology    Software Application Washington
5    NVIDIA Corporation Technology          Semiconductors California
6                 Tesla Technology Software Infrastructure      Texas
  Founding.Year Annual.Revenue.2022.2023..USD.in.Billions.
1          1976                                     387.53
2          1975                                     204.09
3          1998                                     282.83
4          1994                                     513.98
5          1993                                      26.97
6          2003                                      81.46
  Market.Cap..USD.in.Trillions. Stock.Name
1                         2.520       AAPL
2                         2.037       MSFT
3                         1.350       GOOG
4                         1.030       AMZN
5                         0.653       NVDA
6                         0.625       TSLA
  Annual.Income.Tax.in.2022.2023..USD.in.Billions. Employee.Size
1                                           18.314        164000
2                                           15.139        221000
3                                           11.356        190234
4                                           -3.217       1541000
5                                            0.189         22473
6                                            1.132        127855
'data.frame':   50 obs. of  10 variables:
 $ Company.Name                                    : chr  "Apple Inc." "Microsoft Corporation" "Alphabet (Google)" "Amazon" ...
 $ Industry                                        : chr  "Technology" "Technology" "Technology" "Technology" ...
 $ Sector                                          : chr  "Consumer Electronics" "Software Infrastructure" "Software Infrastructure" "Software Application" ...
 $ HQ.State                                        : chr  "California" "Washington" "California" "Washington" ...
 $ Founding.Year                                   : int  1976 1975 1998 1994 1993 2003 2004 1961 1977 1984 ...
 $ Annual.Revenue.2022.2023..USD.in.Billions.      : num  388 204 283 514 27 ...
 $ Market.Cap..USD.in.Trillions.                   : num  2.52 2.037 1.35 1.03 0.653 ...
 $ Stock.Name                                      : chr  "AAPL" "MSFT" "GOOG" "AMZN" ...
 $ Annual.Income.Tax.in.2022.2023..USD.in.Billions.: num  18.314 15.139 11.356 -3.217 0.189 ...
 $ Employee.Size                                   : int  164000 221000 190234 1541000 22473 127855 86482 20000 143000 83300 ...

Step 3: Select Top 10 Companies

No renaming needed Directly use Revenue

             Company.Name   Industry                  Sector   HQ.State
1                  Amazon Technology    Software Application Washington
2              Apple Inc. Technology    Consumer Electronics California
3       Alphabet (Google) Technology Software Infrastructure California
4   Microsoft Corporation Technology Software Infrastructure Washington
5          Meta Platforms Technology Software Infrastructure California
6  Dell Technologies Inc. Technology       Computer Hardware      Texas
7                   Tesla Technology Software Infrastructure      Texas
8       Intel Corporation Technology          Semiconductors California
9         IBM Corporation Technology             IT Services   New York
10                HP Inc. Technology       Computer Hardware California
   Founding.Year Revenue Market.Cap..USD.in.Trillions. Stock.Name
1           1994  513.98                         1.030       AMZN
2           1976  387.53                         2.520       AAPL
3           1998  282.83                         1.350       GOOG
4           1975  204.09                         2.037       MSFT
5           2004  116.60                         0.524       META
6           1984  102.30                         0.028       DELL
7           2003   81.46                         0.625       TSLA
8           1968   63.05                         0.118       INTC
9           1911   60.52                         0.113        IBM
10          1939   59.78                         0.028        HPQ
   Annual.Income.Tax.in.2022.2023..USD.in.Billions. Employee.Size
1                                            -3.217       1541000
2                                            18.314        164000
3                                            11.356        190234
4                                            15.139        221000
5                                             5.619         86482
6                                             0.981        133000
7                                             1.132        127855
8                                            -0.249        131900
9                                            -0.626        345000
10                                            1.238         51000

Step 4: Create Multi-Year Data

Simulate revenue for 2019–2023 Add variation using random values

Code: set.seed(123)

years <- 2019:2023

bump_data <- top_companies %>% select(Company.Name, Revenue) %>% crossing(Year = years) %>% mutate( Revenue = Revenue * runif(n(), 0.7, 1.2), Company = Company.Name )

Step 5: Ranking Companies

Rank companies year-wise Higher revenue → better rank

Code: bump_data <- bump_data %>% group_by(Year) %>% mutate(Rank = rank(-Revenue, ties.method = “first”))

Step 6: Create Bump Chart

Understanding the Bump Chart

Bump Chart → shows ranking changes over time Lines → represent companies Points → rank at each year Rank 1 → highest revenue scale_y_reverse() → rank 1 at top Colors differentiate companies

Key Insights

Easy to track rank movement Identify: Consistent performers Sudden changes Helps in trend comparison Conclusion Bump chart clearly shows ranking fluctuations Useful for analyzing multi-year performance Effective and visually intuitive representation

THANK YOU