makePalette is a package containing functions that allow you to create your own color palette from an image, using mathematical algorithms.
Install makePalette from CRAN:
install.packages("makePalette")
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.
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.
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)
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)
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)
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)
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)
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)
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)