Site icon R-bloggers

Color palettes inspired by Islamic art

[This article was first published on R on From System to System, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This post is about my new R package IslamicArt, which provides color palettes inspired by Islamic art. Disclaimer: While I accept the Islamic theology, ethnically speaking, I’m not from the Middle East, North Africa, Central Asia, South Asia, or Southeast Asia. However, I do deeply appreciate art and philosophy from what’s conventionally known as the Islamic world as well as Sufism. This R package is only about colors, not about theology. The cultural heritage in and of itself does not necessarily comform to the Quran. Therefore, in the documentation of this package, I mean by “Islamic” what’s culturally “Islamic”, not what’s theologically Islamic.

When talking about the Islamic world, the first things that come to people’s mind may be authoritarian third world countries and war. However, the Islamic world is and has been far more than that. Between about 9th century and about 16th century was a golden age of the Islamic world, in which philosophy (“science” was natural philosophy), math, astronomy, physics, and medicine flourished. That was an era when Greek philosophy was translated, intensively studied, and preserved, and through which Europe was introduced to Aristotle and more of Greek philosophy.

Why did the golden age decline, so much so that the Islamic world is so behind in science today? This is complicated. Some blame al-Ghazali for his book Incoherence of Philosophers, that made Muslims dogmatic and closed to rational inquiry. However, this turns out to be a myth, and has been debunked in the book Galileo Goes to Jail: And Other Myths About Science and Religion. Islamic philosophy in fact went on after al-Ghazali, and al-Ghazali in fact advocated for critical thinking in the Incoherence of Philosophers. Some would attribute the decline to the Mongol invasion that lead to the collapse of the Abbasid Empire, so scholars no longer had a place to do research. One theory attributes the decline to Nizamiyya colleges, which focused on religious studies at the expense of scientific (I mean natural philosophy) inquiry, and as a result, becoming religious scholars became more attractive than becoming natural philosophers. In the book Holistic Islam, Mevlevi sheikh Kabir Edmund Helminski suggested that the turning of Islamic scholars from an originally spiritual Islam to legalism lead to the demise of Islamic civilization. The book Lost Islamic History suggests that European colonialists’ authoritarian rule and division of Islamic lands into small portions contributed to the demise of Islamic civilization.

There’re many theories, and there isn’t one single cause to the demise of the Islamic golden age. Anyway, though the golden age is now lost in history, many artifacts from that era are still available for visit, as tourist attractions or as museum exhibits. That’s why I wrote the R package IslamicArt. This package can’t bring the Islamic golden age back. However, at least it can let us commemorate the history by incorporating color schemes of related historical artifacts, mostly from that period, some earlier and some later, into our statistical graphics.

This package provides color palettes inspired by Islamic art, and can be used both with base R and ggplot2. These colors are especially useful when visualizing data related to the Islamic world. This package was also inspired by custom palette packages like ochRe for Australia-inspired palettes and dutchmasters, palettes derived from 17th century Dutch paintings. I borrowed a lot of code and documentation from ochRe.

This package is not yet on CRAN, so must be installed this way:

devtools::install_github("lambdamoses/IslamicArt")
library(ggplot2)
library(dichromat)
library(IslamicArt)
theme_set(theme_bw())

These are the palettes in this package:

viz_palettes(islamic_palettes)

Since the colors and their ordering were chosen by hand to recapitulate color orderings in the original artifacts, the colors do NOT correspond to numeric values and using these palettes for continuous values is discouraged. By default, the ggplot2 color scales from this package are discrete.

ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
  geom_point() +
  scale_color_islamic(palette = "shiraz2")

This palette is derived from a Quran manuscript from Shiraz that made heavy use of gold leaves and blue paint.

ggplot(diamonds, aes(color, fill = clarity)) +
  geom_bar() +
  scale_fill_islamic(palette = "samarqand")

This palette is derived from the blue domes, stone walls, dark blue and turquoise tiles, and stone floor from Samarqand, Uzbekistan.

ggplot(diamonds, aes(clarity, fill = color)) +
  geom_bar(position = "fill") +
  scale_fill_islamic(palette = "cordoba")

This palette is derived from the horseshoe arches, pillars, and the mihrab (a niche in mosques facing Mecca) in the Grand Mosque of Cordoba.

# Do a continuous one anyway
filled.contour(volcano, color.palette = islamic_pal(palette = "jerusalem"), asp = 1)

This palette is derived from colors of Dome of the Rock. Here the top of the volcano is colored like the golden dome, and the lower parts of the volcano are colored like the blue and green tiles, and the very bottom of the volcano is colored like the stone floor surrounding Dome of the Rock.

Here are simulations of how color blindness will affect perception of the palettes. For those who are not color blind, use this section to choose palettes readable by people with color blindness.

# Deutanopia
pal_deutan <- lapply(islamic_palettes, dichromat, type = "deutan")
viz_palettes(pal_deutan)

# Protanopia
pal_protan <- lapply(islamic_palettes, dichromat, type = "protan")
viz_palettes(pal_protan)

# Tritanopia
pal_tritan <- lapply(islamic_palettes, dichromat, type = "tritan")
viz_palettes(pal_tritan)

Let’s block ads! (Why?)

To leave a comment for the author, please follow the link and comment on their blog: R on From System to System.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.