Mad about you, orchestrally.feel the vibe, feel the terror, feel the painmore quotes

# colors: engaging

In Silico Flurries: Computing a world of snow. Scientific American. 23 December 2017

# data visualization + art

Enjoy colors?
Take a look at my color projects and resources.

# Color proportions in country flags

(right) 256 country flags as concentric circles showing the proportions of each color in the flag. (left) Unique flags sorted by similarity.

Country flags are pretty colorful and some are even pretty.

Instead of drawing the flag in a traditional way (yawn...), I wanted to draw it purely based on the color proportions in the flag (yay!). There are lots of ways to do this, such as stacked bars, but I decided to go with concentric circles. A few examples are shown below.

Country flags drawn as concentric rings. The width of each ring is proportional to square root of the area of that color in the flag. Only colors that occupy 1% or more of the flag are shown. (zoom)

Once flags are drawn this way, they can be grouped by similarity in the color proportions.

## sampling flag colors

To determine the proportions of colors in each flag, I started with the collection of all country flags in SVG from Wikipedia. The flags are conveniently named using the countries' ISO 3166-2 code. At the time of this project (21 Mar 2017), this repository contained 312 flags, of which I used 256.

I originally wanted to use the flag-icon-css collection, but ran into problems with it. It had flags in only either 1 × 1 or 4 × 3 aspect ratio, which distorted and clipped many flags. Many flags were also inaccurately drawn and had inconsistent use of colors. For example, in Turkey's flag the red inside the white crescent was slightly different than elsewhere in the flag.

Flags of 256 countries and territories drawn as concentric circles representing the proportions of colors in the flag. The flags are labeled with the country's ISO 3166-2 code. (BUY ARTWORK)

I converted the SVG files to high resolution PNG (2,560 pixels in width) and sampled the colors in each flag, keeping only those colors that occupied at least 0.01% of the flag. I apply this cutoff to avoid blends between colors due to anti-aliasing applied in the conversion. When drawing the flags as circles, I only use colors that occupy at least 1% of the flag—this impacts flags that have detailed emblems, such as Belize. I apply some rounding off of the proportions and colors with the same proportion are ordered so that lighter colors (by Lab luminance) are in the center of the circle.

There are various ways to represent the proportions of the flag colors as concentric rings—in other words, to use symbols of different size to encode area.

The accurate way is to have the area of the ring be proportional to the area of the color on the map. The inaccurate way is to encode the area by the the width of the ring. These two cases are the $k=0.5$ and $k=1$ columns in the figure below, where $k$ is the power in $r = a^k$ by which the radius of the ring, $r$, is scaled relative to the area, $a$. A perceptual mapping using $k=0.57$ has been suggested by some.

The concentric rings can be drawn to be either accurate in area (left, $k=0.5$) or to have their width encode the area (right, $k=1$). The hybrid approach is a mix of these two extremes. (zoom)

My goal here is not to encode the proportions so that they can be read off quantitatively. To find a value of $k$, I drew some flags and looked at their concentric ring representation. For example, with $k=0.57$ the Nigerian flag's white center is too large for my eye while for $k=1$ it is definitely too small. I liked the proportions for $k=1/\sqrt{2}$ but wasn't happy with the fact that flags like France's, which have colors in equal areas, didn't have equal width rings.

In the end I decided on a hybrid approach in which the out radius of color $i$ whose area is $a_i$ is $r_i = a_i^k + \sum_{j=0}^{i-1} a_j^k$ where the colors are sorted so that $a_{i-1} \le a_i$. If I use $k=0.25$, I manage to have flags like France have equal width rings but flags like Nigeria in which the proportions are not equal are closer to the encoding with $k=1/\sqrt{2}$. In this hybrid approach smaller areas, such as the white in the map of Turkey, are exaggerated. Notice that here $k$ plays a slightly different role—it's used as the power for each color individually, $\sum a^k$, rather than their sum, $\left({\sum a}\right)^k$.

For the purists this choice of encoding might appear as the crime of the worst sort, representing neither correct ($k=0.5$) nor the conventionally incorrect encoding associated with $k=1$. Think of it this way—I know what rule I'm breaking.

## calculating flag similarity

The similarity between two flags is calculated by forming an intersection between the radii positions of the concentric rings of the flags.

Example of how flag similarity is calculated using the flags of Ukraine and Sweden. (zoom)

For each intersection, the similarity of colors is determined using $\Delta E$, which is the Euclidian distance of the colors in LCH space. I placed less emphasis on luminance and chroma in the similarity calculation by fist transforming the coordinates to $(\sqrt L,\sqrt C, H)$) before calculating color differences. The similarity score is $$S = \sum \frac{\Delta r}{\sqrt{\Delta E}}$$

Color pairs with $\Delta E < \Delta E_{min} = 5$ are considered the same and have an effective $\Delta E = 1$.

The order of flags using different approaches to calculating the similarity score. (zoom)

I explored different cutoffs and combinations of transforming the color coordinates. This process was informed based on how the order of the flags looked to me.

Reasonable ordering for some similar flags achieved by optimizing how similarity between flags is calculated. (zoom)

I decided to start the order with Tonga, since it had the highest average similarity score to all other flags in some of my trials. The flag that is most different from other flags, as measured by the average similarity score, is Israel.

(left) Order of flags when starting with Tonga. (right) Order of flags when starting with Israel, which is has the lowest average similarity score of all flags. (zoom)
Flags of 256 countries and territories drawn as concentric circles representing the proportions of colors in the flag. Flags are sorted by similarity in color proportion and labeled with the country's ISO 3166-2 code. (BUY ARTWORK)

### country flag colors

I couldn't find a list of colors in the flags of countries, so I provide my analysis here. Every country's SVG flag was converted into a 2,560 × 1,920 PNG file (4,915,200 pixels). Colors that occupied at least 0.01% of the pixels are listed in their HEX format, followed by the number of pixels they occupy. The fraction of the flag covered by sampled colors is also shown.

$DOWNLOAD #code img_pixels sampled_pixels fraction_sampled_pixels hex:pixels,hex:pixels,... ... cm 4366506 4364514 0.999544 FCD116:1513103,007A5E:1456071,CE1126:1395340 cn 4369920 4364756 0.998818 DE2910:4260992,FFDE00:103764 co 4364800 4364800 1.000000 FCD116:2183680,003893:1090560,CE1126:1090560 ...$

### country similarity score

$DOWNLOAD #code1 code2 similarity_score ad ae 0.0108360578506763 ad af 0.0288161214840692 ad ag 0.0510922121861494 ad ai 0.42746294322472 ... zw ye 0.473278765746989 zw yt 0.238101673130705 zw za 0.810589244643825 zw zm 0.573265751850587$
VIEW ALL

# Molecular Case Studies Cover

Fri 06-07-2018

The theme of the April issue of Molecular Case Studies is precision oncogenomics. We have three papers in the issue based on work done in our Personalized Oncogenomics Program (POG).

The covers of Molecular Case Studies typically show microscopy images, with some shown in a more abstract fashion. There's also the occasional Circos plot.

I've previously taken a more fine-art approach to cover design, such for those of Nature, Genome Research and Trends in Genetics. I've used microscopy images to create a cover for PNAS—the one that made biology look like astrophysics—and thought that this is kind of material I'd start with for the MCS cover.

Cover design for Apr 2018 issue of Molecular Case Studies. (details)

# Happy 2018 $\tau$ Day—Art for everyone

Wed 27-06-2018
You know what day it is. (details)

# Universe Superclusters and Voids

Mon 25-06-2018

A map of the nearby superclusters and voids in the Unvierse.

By "nearby" I mean within 6,000 million light-years.

The Universe — Superclustesr and Voids. The two supergalactic hemispheres showing Abell clusters, superclusters and voids within a distance of 6,000 million light-years from the Milky Way. (details)

# Datavis for your feet—the 178.75 lb socks

Sat 23-06-2018

In the past, I've been tangentially involved in fashion design. I've also been more directly involved in fashion photography.

It was now time to design my first ... pair of socks.

Some datavis for your feet: the 178.75 lb socks. (get some)

In collaboration with Flux Socks, the design features the colors and relative thicknesses of Rogue olympic weightlifting plates. The first four plates in the stack are the 55, 45, 35, and 25 competition plates. The top 4 plates are the 10, 5, 2.5 and 1.25 lb change plates.

The perceived weight of each sock is 178.75 lb and 357.5 lb for the pair.

The actual weight is much less.

# Genes Behind Psychiatric Disorders

Sun 24-06-2018

Find patterns behind gene expression and disease.

Expression, correlation and network module membership of 11,000+ genes and 5 psychiatric disorders in about 6" x 7" on a single page.

Design tip: Stay calm.

An analysis of dust reveals how the presence of men, women, dogs and cats affects the variety of bacteria in a household. Appears on Graphic Science page in December 2015 issue of Scientific American.

More of my American Scientific Graphic Science designs

Gandal M.J. et al. Shared Molecular Neuropathology Across Major Psychiatric Disorders Parallels Polygenic Overlap Science 359 693–697 (2018)

# Curse(s) of dimensionality

Tue 05-06-2018
There is such a thing as too much of a good thing.

We discuss the many ways in which analysis can be confounded when data has a large number of dimensions (variables). Collectively, these are called the "curses of dimensionality".

Nature Methods Points of Significance column: Curse(s) of dimensionality. (read)

Some of these are unintuitive, such as the fact that the volume of the hypersphere increases and then shrinks beyond about 7 dimensions, while the volume of the hypercube always increases. This means that high-dimensional space is "mostly corners" and the distance between points increases greatly with dimension. This has consequences on correlation and classification.

Altman, N. & Krzywinski, M. (2018) Points of significance: Curse(s) of dimensionality Nature Methods 15:399–400.