Package RanglaPunjab

Sonia Bhar Ahluwalia

2018-07-27

R code that defines color palettes based on the unique, vibrant culture of Punjab, India.

Rangla Punjab translates to “Colorful Punjab”.

And if you ever visit India, Rangla Punjab is a wonderful Punjabi theme village of generations gone by.

In the meantime, enjoy this R package :-)

Functions

  • Rangla Punjab: RanglaPunjab(name)
  • List Palette: ListPalette()
  • Merge Palette: MergePalette(name, name2, name3)
  • Paint Palette: PaintPalette(name, name2, name3)
  • Cherry Pick Palette: CherryPickPalette(name, name2, name3)
  • Show Palette Photo: ShowPalettePhoto(name)
  • Sample Code

  • 3-D Pie Chart
  • Bar Plot
  • Rangla Punjab: RanglaPunjab(name)

    Input 1 palette, return vector of colors

    > RanglaPunjab("GoldenTemple")
    [1] "#bdcad0" "#5f8abf" "#ffd860" "#d88821" "#672006"

    List Palette: ListPalette()

    Lists all 24 palettes

    > ListPalette()
     [1] "FieldsOfPunjab"       "FieldsOfPunjab2"        "GoldenTemple"           "GoldenTemple2"         
     [5] "Pindh"                "Haveli"                 "Haveli2"                "AmritsariKulcha"       
     [9] "CholeBhature"         "BiryaniRice"            "AmritsariLassi"         "AmritsariPedeWaliLassi"
    [13] "Kulfi"                "SohniMahiwal"           "HeerRanjha"             "Gidha"                 
    [17] "Gidha2"               "Teej"                   "Phulkari"               "Phulkari2"             
    [21] "Jutti"                "Jutti2"                 "Jutti3"                 "Paranda" 

    Merge Palette: MergePalette(name, name2, name3)

    Input 2 to 3 palettes to merge into new palette

    MergePalette("AmritsariKulcha", "Phulkari2")
    [1] "#e3e4d9" "#ebdc9c" "#b3340e" "#67140a" "#2a231d" "#9c1a41" "#42a4e8" "#3a35da" "#ee523c" "#3e167c"

    Paint Palette: PaintPalette(name, name2, name3)

    Input 1 to 3 palettes to display their colors on screen

    > PaintPalette("FieldsOfPunjab","Jutti","Paranda")

    Paint Palette

    Cherry Pick Palette: CherryPickPalette(name, name2, name3)

    Input 2 to 3 palettes to visually select colors to create new palette. Will open interactive shiny app and save list of colors tocherrypickedpalette.

    > CherryPickPalette("GoldenTemple","GoldenTemple2")

    Cherry Pick Palette Animated

    Show Palette Photo: ShowPalettePhoto(name)

    Input 1 palette to display photo that inspired these colors

    > ShowPalettePhoto("Jutti3")

    Jutti 3

    3-D Pie Chart

    Use RanglaPunjab to color pie charts.

    library(RanglaPunjab)
    library(plotrix)
    
    slices <- c(10, 12, 4, 16, 8) 
    lbls <- c("US", "UK", "Australia", "Germany", "France")
    pie3D(slices,labels=lbls, explode=0.1, col=RanglaPunjab("Gidha"), main="Pie Chart of Countries ")

    3-D Pie Chart

    Bar Plot

    Use CherryPickPalette to dynamically color bar plots.

    library(RanglaPunjab)
    
    counts <- table(mtcars$vs, mtcars$gear)
    barplot(counts, main="Car Distribution by Gears and VS",
            xlab="Number of Gears", col=CherryPickPalette("Teej","Jutti"),
            legend = rownames(counts))

    Bar Plot