Visualizing correlation with double y-axes using the ggplot2 R package (CC235)

Поделиться
HTML-код
  • Опубликовано: 15 июл 2024
  • Should you visualize your data using double y-axes? In this Code Club, Pat will show how to assess correlations using ggplot2 using faceted line plots, line plots on double y-axes, and using a scatter plot. Finally, he'll use cor.test there's a lot of other great gems to be found in the episode.
    You can find my blog post for this episode at www.riffomonas.org/code_club/....
    #ggplot2 #dplyr #R #Rstudio #Rstats
    Want more practice on the concepts covered in Code Club? You can sign up for my weekly newsletter at shop.riffomonas.org/youtube to get practice problems, tips, and insights.
    If you're interested in taking an upcoming 3 day R workshop be sure to check out our schedule at riffomonas.org/workshops/
    You can also find complete tutorials for learning R with the tidyverse using...
    Microbial ecology data: www.riffomonas.org/minimalR/
    General data: www.riffomonas.org/generalR/
    0:00 Introduction
    1:02 Calculating average annual temperature and total precipitation data
    5:21 Creating a faceted line plot
    8:39 Creating a line plot with a double y-axis
    13:16 Rescaling both y-axes
    17:58 Should we use double y-axes?
    19:44 Plotting variables against each other
    21:03 Measuring correlation between variables
  • НаукаНаука

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

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

    You are a master. Thanks for your detailed explanations!

  • @ndongoseye837
    @ndongoseye837 Год назад +2

    Thanks Pat, It's so helpful. I enjoy how you explain and your pedagogical approach.

    • @Riffomonas
      @Riffomonas  Год назад +1

      My pleasure thank for watching!🤓

  • @tongakuot
    @tongakuot Год назад +1

    Great tutorial; thank you for sharing!

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

      Thanks! Glad you enjoyed the video🤓

  • @marc_CFA_applied_econ
    @marc_CFA_applied_econ Год назад +1

    Another terrific installment. Thanks for reminding me about "cor.test." I almost never report p-values and I should. Also reminded me why dual y-axes are flawed.

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

      Fantastic- thanks for watching!

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

    Thank you for a great tutorial Prof. Pat.
    I live in Bangkok, Thailand. There is a correlation between tmax (average) and prcp with p-value = 2.081e-05 and cor = -0.49.

  • @peteralfred7006
    @peteralfred7006 Год назад +1

    Thanks Pats

  • @haraldurkarlsson1147
    @haraldurkarlsson1147 Год назад +3

    I have seen much worse. Plots with four variables on the same plot. On read from the left side up (temp I belive), another read on the right side (precip). The third variable (vegitation) was added to the top part but without a scale. Finally the lower half of the graph was in meters and showed the depth of erosion. All of this plotted against latitude along the x. I think if anyone can read this monstrosity they should get a medal for the "worst" plot.

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

      Lol there’s some climate change figures out there like that. Scary stuff🤓

  • @md.izazulhaq
    @md.izazulhaq 10 месяцев назад

    You're the best! Loved your content. Please make a video tutorial on how to convert irregular daily/fortnightly timesereis with lots of NA's and mutlple varibles into regular motntly timeserie data.

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

    In 14:11, you should have remembered to subtract tmax_min. It should be divided by (tmax_max - tmax_min).

  • @divereduardomarinpalacio3636
    @divereduardomarinpalacio3636 Год назад +2

    Pat! It was a nice and helpful video, Thank you so much. I have a question: It is possible to do figures with double X-axes in ggplot? As you mentioned in the video the best option is to show the variables in different panels, but sometimes when you work with hydroclimatological variables could be useful to have a double X-axis.

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

      Great! You would do the same things I did but with the x axis. Still not advised though. Better to use facets…

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

    I need help on plotting classic SPI

  • @hipolitocardoso6968
    @hipolitocardoso6968 9 месяцев назад

    Hi, i want to sum each five (5) days cumulative precipitation using R. any help?

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

    Can you please do a correlation visualization of species from any metagenomic dataset? Because with a lot of species, the visualization becomes challenging, would like to see if it can be done in a better way.

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

      Thanks Vikas! I don't think i'll be coming back to microbiome data analysis any time soon. As always, I'd suggest starting with figuring out the biological question you are trying to answer and go from there. So, what do you expect a correlation analysis to show? I'd build a visual around that question. If you just want to show a big ball of nodes and edges indicating correlations, then yeah, it's going to look horrible 🤣 But I'd hope you might have a better question!