Scatterplots in R with geom_point() and geom_text/label()

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

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

  • @TheDataDigest
    @TheDataDigest  2 месяца назад

    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

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

    Amazing in depth tutorial, best I've seen on the subject by a long shot

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

      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.

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

    Very useful details. Thank you.

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

      That's very nice to hear, thank you :)

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

    Hi thank you for this! Can you explain the difference between ggplot and ggplot2?

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

      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.

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

    Keep the sentence /function meaningful with using the pipe %>%
    users (python, etc) can easily understand your code

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

    Thanks

  • @lucy6692
    @lucy6692 9 месяцев назад +1

    What do I do if I want to assign shapes to more than 6? how do I assign them individually?

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

      Hi Lucy, thanks for leaving a comment.
      If you run the following code:
      test_df

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

    How would you add a regession line on this type of scatterplot?

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

      + 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.

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

    What if the R version doesn't have ggplot package. Is there any substitute package??

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

      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.

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

      @@TheDataDigest please provide me the first code as it showed an error when I typed

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

    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.

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

      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

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

      @@TheDataDigest Thank you so much.

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

    Can you save the plot as html or whatever and keep it interactive?

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

      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
      @hassanhijazi4757 2 года назад +1

      @@TheDataDigest Super! Appreciate it.

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

      @@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.