You can download the R code from this video here in my free skool community: www.skool.com/data-analysis-with-r-6607/classroom/daa88316?md=12b8c611cb734142af09e4c3f68ac7e4
Thanks for the comment. I try to fit as much information in as possible in a 15-20 minute video, with some good structure and examples. I though if someone spends the time to watch one of my videos, they should get the most out of it. Not sure whether I always succeed with this approach, but at least I try. :D glad you liked it.
Sure. ggplot2 is the package name and ggplot is the plotting function. Try out: "help(ggplot2)" and "help(ggplot)" to see the difference and learn more. By the way, the "gg" stands for the "Grammar of Graphics" which is the concept between the different layers of the plot.
+ geom_smooth(method = "lm", se = FALSE) Would add a regression line without standard error (by default you get a 95% confident interval). Depending on previous grouping (mapping color etc.) you would get several lines, one per group or just one line. Check out my latest 53 geoms video where I show some geom_smooth() examples to learn more.
You should be able to install it. Just type in the console: install.packages("ggplot2") After that: library(ggplot2) You can also click in the packages panel of RStudio and search for it in CRAN with the install tab.
Hi, thanks for the video, it is quite helpful. However, I am stuck on the more than 6 shapes, I am working on 9 species and I am struggling with plotting the shapes for the other three. Your help would be highly appreciated.
Hi Ditiro, thanks for the comment. Here are a few ideas that might help you. If your species are somehow similar you could group them to reduce them from 9 shapes to 6. Or use the same shape for 2-3 species but work with different colors for them. There is a good reason that ggplot() by default only shows 6 shapes as they become more difficult to differentiate. Another option would be to work with facet wrap to split your species apart and only show 4-5 at the same time. And lastly, there is of course a way to force ggplot to use more than 6 shapes: stackoverflow.com/questions/26223857/more-than-six-shapes-in-ggplot
Hi Hassan, thanks for the comment. The R-Graph-Gallery also has tutorial on interactive graphs with a special section on how to save it as html or png. www.r-graph-gallery.com/interactive-charts.html Hope that already helps you.
@@hassanhijazi4757 In my new video tomorrow I will actually make use of the saveWidget() function so thanks again for the feedback/comment. Was a good opportunity for me to learn something new.
You can download the R code from this video here in my free skool community:
www.skool.com/data-analysis-with-r-6607/classroom/daa88316?md=12b8c611cb734142af09e4c3f68ac7e4
Amazing in depth tutorial, best I've seen on the subject by a long shot
Thanks for the comment. I try to fit as much information in as possible in a 15-20 minute video, with some good structure and examples. I though if someone spends the time to watch one of my videos, they should get the most out of it. Not sure whether I always succeed with this approach, but at least I try. :D glad you liked it.
Very useful details. Thank you.
That's very nice to hear, thank you :)
Hi thank you for this! Can you explain the difference between ggplot and ggplot2?
Sure. ggplot2 is the package name and ggplot is the plotting function.
Try out: "help(ggplot2)" and "help(ggplot)" to see the difference and learn more.
By the way, the "gg" stands for the "Grammar of Graphics" which is the concept between the different layers of the plot.
Keep the sentence /function meaningful with using the pipe %>%
users (python, etc) can easily understand your code
Thanks
What do I do if I want to assign shapes to more than 6? how do I assign them individually?
Hi Lucy, thanks for leaving a comment.
If you run the following code:
test_df
How would you add a regession line on this type of scatterplot?
+ geom_smooth(method = "lm", se = FALSE)
Would add a regression line without standard error (by default you get a 95% confident interval). Depending on previous grouping (mapping color etc.) you would get several lines, one per group or just one line. Check out my latest 53 geoms video where I show some geom_smooth() examples to learn more.
What if the R version doesn't have ggplot package. Is there any substitute package??
You should be able to install it. Just type in the console: install.packages("ggplot2")
After that: library(ggplot2)
You can also click in the packages panel of RStudio and search for it in CRAN with the install tab.
@@TheDataDigest please provide me the first code as it showed an error when I typed
Hi, thanks for the video, it is quite helpful. However, I am stuck on the more than 6 shapes, I am working on 9 species and I am struggling with plotting the shapes for the other three. Your help would be highly appreciated.
Hi Ditiro, thanks for the comment. Here are a few ideas that might help you. If your species are somehow similar you could group them to reduce them from 9 shapes to 6. Or use the same shape for 2-3 species but work with different colors for them.
There is a good reason that ggplot() by default only shows 6 shapes as they become more difficult to differentiate.
Another option would be to work with facet wrap to split your species apart and only show 4-5 at the same time.
And lastly, there is of course a way to force ggplot to use more than 6 shapes:
stackoverflow.com/questions/26223857/more-than-six-shapes-in-ggplot
@@TheDataDigest Thank you so much.
Can you save the plot as html or whatever and keep it interactive?
Hi Hassan, thanks for the comment. The R-Graph-Gallery also has tutorial on interactive graphs with a special section on how to save it as html or png.
www.r-graph-gallery.com/interactive-charts.html
Hope that already helps you.
@@TheDataDigest Super! Appreciate it.
@@hassanhijazi4757 In my new video tomorrow I will actually make use of the saveWidget() function so thanks again for the feedback/comment. Was a good opportunity for me to learn something new.