Pirate plot: Advanced data visulisation using R , RID plot

Поделиться
HTML-код
  • Опубликовано: 21 авг 2024
  • #RID #datavisualization #rprogramming #pirateplot
    In this video, i demonstrated use of pirate plot to as an advanced alternative to a barplot.
    pirate plot is from Nathaniel Philips' "Yarrr" package. It shows raw data as points with adjusted opacity, data distribution as violin plots like beans, inference like 95% Ci as a rectangular inference box and descriptive statistics like mean or median as a conspicuous bar. All the required elements of an honest plot. All these elements discussed above can be customised for all the visual attributes.
    Also this is a base R plot. It can be customised using base R plot functions.
    install.packages("yarrr")
    library(yarrr)
    str(iris)
    pirateplot(Sepal.Length~Species, iris,theme = 4)
    text(1, 7.5, label=" Pirate plot shows RID")
    ?pirateplot
    citation("yarrr")
    library(tidyr)
    library(dplyr)
    iris_long = pivot_longer(iris, 1:4,names_to = "flowerpart", values_to = "len")
    pirateplot(len~Species+flowerpart,iris_long)
    Facebook page:
    / rajendrachoureisc
    Mail Id:
    rajuchoure@gmail.com
    youtube playlist:
    • R programming tutorials

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

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

    Thanks

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

      Thanks a lot for this appreciation. It helps a lot.

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

    Ohhh, thanks for the video, was interesting.

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

    Is it same as violin plot including boxplot???

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

      No violin plot shows local density and boxplots shows quantities. Raw data is not showed. If we overlay raw data as points, then this becomes overplotting.
      Pirate plot dp not show quantiles, it shiw median or mean and 95%CI. Local distribution using beans , jittered points are for raw data. Overplotting is avoided by not displaying quantiles.

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

    sir, can u please tell how did you arranged your data for pirate plot, like what are the variables you have taken, just 5 or any other variables you have taken to draw a pirate plot

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

      If you share head(data) or data to Rajuchoure@gmail.com, i may help you.

  • @suherman.suherman4697
    @suherman.suherman4697 Год назад

    Hi sir, how to demonstrate a pirate plot for multiple (In X-Axist are Grade+Gender, Y-Axis is a cognitive aspect). What is the syntax?

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

      pirateplot(cognitive~Grade+Gender, Data)

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

    Sir, how to make a pirate plot from SPSS data? tell me. Thanks

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

      # download data form
      lo.unisa.edu.au/pluginfile.php/1020313/mod_book/chapter/106604/HLTH1025_2016.sav
      # save daat in your working directory and set working directory
      #use following code to get pirate plot
      setwd("G:\\Rworks\\Spss data import")
      library(foreign)
      df

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

    hello sir can you please tell me how can we add a secondary axis in the existing plot?

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

      # I got this solution from r-graph-gallery.com/line-chart-dual-Y-axis-ggplot2.html
      library(ggplot2)
      data

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

      @@DevResearch thank you sir

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

      @@DevResearch it can be done in pirate plot also??

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

    Thanks. How to make the plot shown in the time stamp 1:11

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

      It is pirate plot with multiple subcategories in a categorical variable. Basically one numeric variable and two categorical variables are plotted using following syntax
      pirateplot(num_var~ cat1+cat2, data)
      The plot at 1.11 is using long table of iris data.
      liibrary(tidyr)
      iris_long= pivot_longer(iris, cols=1:4, names_to="flowerpart",values_to="len")
      library(yarrr)
      pirateplot(len~Species+flowerpart, iris_long)

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

      @@DevResearch Thank you for the code. However, I am a newbie to wrap my head around this code :( Are we trying to pivot the data , what is the need of the package tidyr?

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

      If possible, please plan a video on this. Finally I see I have come to channel where I see R is taught in a very straightforward way..

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

    i have arranged my data according to iris where i am having one character and 3 variables but i am not getting bean and interference i am just getting raw data in the plot, can u pls help me in arranging data sir.

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

      Studied data shared by you. It doesn't have replicate data in treatment-DAS combinations. Pirate plot is not possible.

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

      @@DevResearch sir i have done plotting by adding replicati0ns till i cant get the beans and interference for the code, please, suggest a code for 2 characters and one variable. I have already emailed you back with the edited replicated data. Kndly, have a look sir.