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 Наука
You are a master. Thanks for your detailed explanations!
Thanks Pat, It's so helpful. I enjoy how you explain and your pedagogical approach.
My pleasure thank for watching!🤓
Great tutorial; thank you for sharing!
Thanks! Glad you enjoyed the video🤓
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.
Fantastic- thanks for watching!
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.
Thanks Pats
My pleasure!
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.
Lol there’s some climate change figures out there like that. Scary stuff🤓
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.
In 14:11, you should have remembered to subtract tmax_min. It should be divided by (tmax_max - tmax_min).
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.
Great! You would do the same things I did but with the x axis. Still not advised though. Better to use facets…
I need help on plotting classic SPI
Hi, i want to sum each five (5) days cumulative precipitation using R. any help?
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.
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!