Plotting the global temperature index as bars using ggplot2 and NASA GISS data (CC215)

Поделиться
HTML-код
  • Опубликовано: 1 дек 2024

Комментарии • 31

  • @mukhtarabdi824
    @mukhtarabdi824 2 года назад +2

    Third video in the play list, replicating the code and applying it to the plots needed in my masters. thanks prof

  •  2 года назад +4

    Really enjoy these tutorials, trying to replicate a plot. Thanks!

  • @marc_CFA_applied_econ
    @marc_CFA_applied_econ 2 года назад +1

    Thanks Pat. This was a big help in a pinch.

    • @Riffomonas
      @Riffomonas  2 года назад

      Fantastic! It’s great to hear people getting something out of these more artsy figures

  • @pikineestest7362
    @pikineestest7362 2 года назад +1

    Thanks for sharing this knowledge it's very important.

    • @Riffomonas
      @Riffomonas  2 года назад +1

      My pleasure! Thanks for watching 🤓

  • @Iguan059
    @Iguan059 Год назад

    I realy like these tutorials 😊

  • @stephenfricker8167
    @stephenfricker8167 2 года назад +1

    Thanks, I think I will set aside some time each week for this

    • @Riffomonas
      @Riffomonas  2 года назад

      Wonderful! Thanks for watching 🤓

  • @haraldurkarlsson1147
    @haraldurkarlsson1147 2 года назад +3

    I like the line graph better. However, the colored bar plot has more a of shock value and may make the point more quickly if you are not trying to show details. So if I were giving a poster presentation I use the bar plot to draw people in and then use the line plot to explain in more detail.

  • @yaqinguo8971
    @yaqinguo8971 2 года назад +1

    Excellent! I like the way how it dose. Although i prefer the line plot, this video i have learned so much stuff!
    But generally i have a question with the geom_text to annotate the text into the figure. The text font what was annotated is different from axis-label, for example. I hope you know what i am talking. Because every time, when i want to annotate some text into plot, i always annotate outside of R (e.g. AI), which i don't like it. If you could help me with this, that would be great. Tons thanks!

    • @Riffomonas
      @Riffomonas  2 года назад

      Cool, thanks! you might check out this episode to see how you can customize fonts. Maybe it will help to make things look more uniform riffomonas.org/code_club/2021-08-26-fonts

    • @yaqinguo8971
      @yaqinguo8971 2 года назад

      @@Riffomonas Well noted. Thanks a lot!

  • @Jaymastia
    @Jaymastia Год назад

    How do you plot a standardised precipitation index in R studio?

  • @yaqinguo8971
    @yaqinguo8971 2 года назад +1

    Again, i also saw there is bars with scales on website. That would you great if you could show how to add scales to x-axis and y-axis. Thanks a lot!

    • @Riffomonas
      @Riffomonas  2 года назад

      Thanks for watching - I'm not sure what you mean by "bars with scales" or adding scales to the x and y-axis. I turned the x and y-axes off on this visual to make it look more attractive. This was largely done in the theme function

    • @Riffomonas
      @Riffomonas  2 года назад

      @@yaqinguo8971 Sorry, but I'm not likely going to go back to this series of videos. You can add those axis scales with the theme function

    • @yaqinguo8971
      @yaqinguo8971 2 года назад

      @@Riffomonas Sure. Thanks a lot for your response. I will try to figure it out.

    • @yaqinguo8971
      @yaqinguo8971 2 года назад

      @@Riffomonas I managed it with library(ggh4x). Super excited.

  • @22bears
    @22bears 2 года назад +1

    I'm giving up because even tho I follow the tutorial really close, with the same dataset, (csv), and I type everything exactly the same, I get errors or a different outcome :/

    • @Riffomonas
      @Riffomonas  2 года назад

      Sorry! If there's a point at which things go off the rails for you let me know and I can see what can be done to help out

    • @22bears
      @22bears 2 года назад +1

      @@Riffomonas Thank you so much, Pat. After trying a few times, I got it done! Can't thank you enough for providing us all these tutorials, you're a master. Greetings from Buenos Aires, Argentina

    • @Riffomonas
      @Riffomonas  2 года назад

      @@22bears wonderful!

  • @activistcoder
    @activistcoder 2 года назад +1

    thank's I was thinking the other day doing the same stuff for the water index using the amazon dataset

    • @Riffomonas
      @Riffomonas  2 года назад

      Awesome - thanks for watching!🤓

  • @mukhtarabdi824
    @mukhtarabdi824 2 года назад

    Prof Schloss, I am getting this error < Error in rescale(c(min(t_data$t_diff), 0, max(t_data$t_diff))) :
    could not find function "rescale" > in that code I replicated:
    Here is the code:
    t__barplot % ggplot(aes(x = year, y = t_diff, fill= t_diff)) +
    geom_col() +
    geom_text(data = annotation, aes(x = x, label = year), color = "white") +
    # scale_fill_gradient2(low = "darkblue",
    # mid = "white",
    # high = "darkred",
    # midpoint = 0,
    # limits = c(-0.5, 1.5)) +
    scale_fill_gradientn(colors = c("darkblue", "white", "darkred"),
    values = rescale(c(min(t_data$t_diff), 0, max(t_data$t_diff))),
    limits = c(min(t_data$t_diff),max(t_data$t_diff))) +
    theme_void() +
    theme(
    plot.background = element_rect(fill = "black"),
    legend.text = element_text(color = "white")
    )
    Any thoughts, please?

    • @Riffomonas
      @Riffomonas  2 года назад +1

      Make sure you ran “library(scales)”

  • @Jaymastia
    @Jaymastia Год назад

    I need the scale