MakePalette
It's a package containing functions that allow you to create your own color palette from an image, using mathematical algorithms
Install / Use
/learn @musajajorge/MakePaletteREADME
makePalette <img src="imgs/hex_emblema_makePalette.png" align="right" width="120"/>
<!-- badges: start -->
<img src="imgs/logo_infinito.png" width="50"/>
makePalette is a package containing functions that allow you to create your own color palette from an image, using mathematical algorithms.
Installation :arrow_double_down:
Install makePalette from CRAN:
install.packages("makePalette")
Usage :muscle:
library(makePalette)
You need an image in jpg, png, tiff or similar format, stored in the hard disk of your PC or in some url.
Examples with the makePaletteCLARA function (Clustering Large Applications)
Example 1
<img src="imgs/picture01.jpeg" width="100%"/>url1 = "https://github.com/musajajorge/makePalette/raw/main/imgs/picture01.jpeg"
curl::curl_download(url1, "picture01.jpeg")
colors <- makePaletteCLARA("picture01.jpeg")
barplot(1:length(colors), col=colors)
By default, the function will return a palette of 4 colors.
<img src="imgs/Rplot1.1.png" width="100%" />If you want a palette with more colors, just specify it in the n parameter.
colors <- makePaletteCLARA("picture01.jpeg", n = 10)
barplot(1:length(colors), col=colors)
<img src="imgs/Rplot1.2.png" width="100%" />
Example 2
<img src="imgs/picture03.jpg" width="100%"/>url3 = "https://github.com/musajajorge/makePalette/raw/main/imgs/picture03.jpeg"
curl::curl_download(url3, "picture03.jpeg")
colors <- makePaletteCLARA("picture03.jpeg", n = 6)
barplot(1:length(colors), col=colors)
<img src="imgs/Rplot2.png" width="100%" />
Example 3
<img src="imgs/picture05.png" width="100%"/>url5 = "https://github.com/musajajorge/makePalette/raw/main/imgs/picture05.png"
curl::curl_download(url5, "picture05.png")
colors <- makePaletteCLARA("picture05.png", n = 6)
barplot(1:length(colors), col=colors)
<img src="imgs/Rplot3.png" width="100%" />
Example 4
<img src="imgs/picture06.png" width="100%"/>url6 = "https://github.com/musajajorge/makePalette/raw/main/imgs/picture06.png"
curl::curl_download(url6, "picture06.png")
colors <- makePaletteCLARA("picture06.png", n = 6)
barplot(1:length(colors), col=colors)
<img src="imgs/Rplot4.png" width="100%" />
Examples with the makePaletteKM function (k-Means)
Example 5
<img src="imgs/picture02.jpg" width="100%"/>url2 = "https://github.com/musajajorge/makePalette/raw/main/imgs/picture02.jpg"
curl::curl_download(url2, "picture02.jpg")
colors <- makePaletteKM("picture02.jpg", n = 10)
barplot(1:length(colors), col=colors)
<img src="imgs/Rplot5.png" width="100%" />
Example 6
<img src="imgs/picture04.png" width="100%"/>url4 = "https://github.com/musajajorge/makePalette/raw/main/imgs/picture04.tiff"
curl::curl_download(url4, "picture04.tiff")
colors <- makePaletteKM("picture04.tiff", n = 6)
barplot(1:length(colors), col=colors)
<img src="imgs/Rplot6.png" width="100%" />
Example 7
<img src="imgs/picture06.png" width="100%"/>url6 = "https://github.com/musajajorge/makePalette/raw/main/imgs/picture06.png"
curl::curl_download(url6, "picture06.png")
colors <- makePaletteKM("picture06.png", n = 6)
barplot(1:length(colors), col=colors)
<img src="imgs/Rplot7.png" width="100%" />
<p align="center"> <img src="imgs/item_infinito.png" width="40%"> </p>
