Grouped pirate plot: an alternative to grouped barplot

Опубликовано: 19 Март 2026
на канале: Rajendra Choure
397
17

#pirateplot #datavisualisation # Rprogramming
#RIDplot #yarrrpackage

In this session, I have demonstrated plotting a 0grouped pirate plot. Grouped pirate plots require two categorical variables and one numeric variable.

I have demonstrated how to get data in the required format using the iris data set as an example. I have gathered four numeric columns of iris and created another column for the names of the columns. This tidy data is suitable for plotting grouped pirate plots.

link for pirate plot video:
   • Pirate plot: Advanced data visulisation us...  

link for formula interface video:
   • Formula interface in R programming: for st...  

#the code


library(yarrr)

head(ToothGrowth)

summary(ToothGrowth)

ToothGrowth$dose

pirateplot(len~supp+dose,ToothGrowth)

head(iris)

library(tidyr)

iris_long = pivot_longer(iris,cols=1:4,names_to= "flowerpart", values_to = "len")

head(iris_long)

str(iris_long)

pirateplot(len~Species+flowerpart,iris_long)


Facebook page:
  / rajendrachoureisc  

Mail Id:
[email protected]

youtube playlist:
   • R programming tutorials