---
title: "Package RanglaPunjab"
author: "Sonia Bhar Ahluwalia"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Package RanglaPunjab}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
R code that defines color palettes based on the [unique, vibrant culture of Punjab, India](https://www.youtube.com/watch?v=wDheWYmNEhQ).
Rangla Punjab translates to "Colorful Punjab".
And if you ever visit India, [Rangla Punjab](https://haveli.co/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
```r
> RanglaPunjab("GoldenTemple")
[1] "#bdcad0" "#5f8abf" "#ffd860" "#d88821" "#672006"
```
List Palette: ListPalette()
Lists all 24 palettes
```r
> 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
```r
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
```r
> PaintPalette("FieldsOfPunjab","Jutti","Paranda")
```
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 to`cherrypickedpalette`.
```r
> CherryPickPalette("GoldenTemple","GoldenTemple2")
```
Show Palette Photo: ShowPalettePhoto(name)
Input 1 palette to display photo that inspired these colors
```r
> ShowPalettePhoto("Jutti3")
```
3-D Pie Chart
Use `RanglaPunjab` to color pie charts.
```r
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 ")
```
Bar Plot
Use `CherryPickPalette` to dynamically color bar plots.
```r
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))
```