IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Quantitative Analysis: NVIDIA

    Selcuk Disci发表于 2024-12-05 11:35:19
    love 0
    [This article was first published on DataGeeek, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
    Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

    Although the investors do not like the pace of revenue growth, in terms of QoQ, NVIDIA’s revenue increased for the first time in five quarters.

    Source code:

    library(tidyverse)
    library(tidyquant)
    library(timetk)
    
    
    #NVIDIA Corporation Earnings
    df_nvda_earnings <- 
      read.delim("https://raw.githubusercontent.com/mesdi/blog/refs/heads/main/nvidia_earnings.txt", header = FALSE) %>% 
      as.tibble() %>% 
      janitor::clean_names() %>% 
      rename(date = v1, revenue = v4) %>% 
      select(date, revenue) %>% 
      mutate(date = parse_date(date, "%b %d, %Y") %>% 
               floor_date("month") %m-% months(2) %>% 
               as.yearqtr(.),
             revenue = str_remove(revenue,"B ") %>% as.numeric()) %>% 
    mutate(revenue = revenue / lead(revenue) - 1) %>% 
      drop_na()
    
    #Plot
    df_nvda_earnings %>% 
      ggplot(aes(x = date, 
                 y = revenue)) +
      geom_col(alpha = 0.7,
               fill = "#76b900") +
      geom_smooth(se = FALSE) +
      geom_text(aes(label= paste0(round(revenue,2) * 100,"%")),
                vjust = ifelse(df_nvda_earnings$revenue >= 0, 1.5, -0.5 ), 
                color = "whitesmoke", 
                fontface = "bold",
                size = 6,
                family = "Roboto Slab") +
      scale_x_yearqtr(format = "%Y Q%q") +
      scale_y_continuous(labels = scales::percent) +
      labs(title = "Change of % <span style='color:#76b900;'>NVIDIA Corporation's Revenue</span>",
           y = "", 
           subtitle = "Quarter over Quarter",
           x = "") + 
      theme_minimal(base_family = "Roboto Slab") + 
      theme(legend.position = "none",
            plot.subtitle = element_text(size = 16),
            plot.title = ggtext::element_markdown(size = 20),
            axis.text = element_text(face = "bold", size = 18),
            text = element_text(face = "bold", size = 20),
            panel.grid = element_blank(),
            plot.background = element_rect(color = "azure", fill = "azure"),
            panel.grid.major.y = element_line(linetype = "dashed", color = "gray"))
    
    

    To leave a comment for the author, please follow the link and comment on their blog: DataGeeek.

    R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
    Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
    Continue reading: Quantitative Analysis: NVIDIA


沪ICP备19023445号-2号
友情链接