Message Boards Message Boards

XKCD in LUV and relationships: semantic proximity of similar colors

Posted 10 years ago
POSTED BY: Vitaliy Kaurov
5 Replies

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: EDITORIAL BOARD

As a newcomer to Wolfram-Community and as a nonscientist I'm overwhelmed by what is possible in Mathematica. And, Vitaliy, what a creative train of thought to combine social data on colors with color theory and percolation theory! What I missed in the xkcd poll were more shades of grey and dark hues. Incidently, In January I finished a new painting "In CIELab color space", which provides more colors to be named

Tryptichon

That's awesome!

After reading this I downloaded the data and did some processing of my own. I focused a bit on the names given to colors.

Starting off similar to you (including the code just so that any small differences won't cause confusion) I import the data and get the names:

fullData=Import["http://xkcd.com/color/rgb.txt","Data"][[All,1;;2]];
names = fullData[[All, 1]];

We can make a histogram showing the distribution of the number of words used in a description:

Histogram[Length/@StringSplit[names]]

Histogram

It's not very interesting because not very many words are typically used. Instead we can calculate the average number of accompanying words to get a more interesting plot:

Histogram@Sort[Merge[Flatten[Function[words,#->Length[words]-1&/@words]/@StringSplit[names]],Mean]]

Histogram

Next we can look at which words are used the most often. This is a pie chart shows the average color of all colors that share a certain word in their names:

nameToColors=SortBy[Merge[Flatten[Function[color,#->color[[2]]&/@StringSplit[color[[1]]]]/@data],Flatten],Length];
PieChart[Length/@nameToColors,ChartStyle->(LUVColor@@Mean[List@@@#]&/@Values[nameToColors])]

Pies are good

And another (uglier) version which labels each slice:

Do I need a description?

We can immediately see what words are popular for describing colors.

This will tell us what words are the most vague, this is being calculated by the mean deviation of

Sort[Function[color,Norm[MeanDeviation[List@@@color]]]/@nameToColors]

Here are the last few:

<| "green" -> 0.301527, "yellowish" -> 0.301806, 
 "orangish" -> 0.309022, "greeny" -> 0.310186, "magenta" -> 0.310729, 
 "red" -> 0.326567, "fuchsia" -> 0.331209, "greenish" -> 0.331261, 
 "cool" -> 0.340017, "purply" -> 0.344614, "yellowy" -> 0.349218, 
 "powder" -> 0.358974, "blood" -> 0.362786, "browny" -> 0.375569, 
 "pink" -> 0.377552, "purple" -> 0.39065, "sea" -> 0.392243, 
 "reddish" -> 0.407342, "pinkish" -> 0.409191, "off" -> 0.414668, 
 "purpley" -> 0.415278, "blue" -> 0.417053, "orangey" -> 0.417463, 
 "purpleish" -> 0.418713, "pale" -> 0.421891, "flat" -> 0.422791, 
 "dull" -> 0.422931, "dusty" -> 0.429657, "muted" -> 0.430807, 
 "dirty" -> 0.431016, "purplish" -> 0.43483, "baby" -> 0.441156, 
 "marine" -> 0.444411, "dark" -> 0.450202, "very" -> 0.458118, 
 "pinky" -> 0.46324, "ugly" -> 0.478061, "bluey" -> 0.489151, 
 "violet" -> 0.490251, "light" -> 0.502694, "faded" -> 0.505302, 
 "soft" -> 0.531751, "mid" -> 0.538431, "deep" -> 0.544057, 
 "warm" -> 0.548372, "bluish" -> 0.549277, "medium" -> 0.553847, 
 "rich" -> 0.571403, "pastel" -> 0.580348, "darkish" -> 0.612625, 
 "true" -> 0.777189, "hot" -> 0.83747, "easter" -> 0.879319, 
 "strong" -> 0.93553, "vibrant" -> 0.938836, "bright" -> 0.939123, 
 "lightish" -> 0.957704, "lighter" -> 0.967594, "vivid" -> 0.998611, 
 "electric" -> 1.07712, "neon" -> 1.08666|>

It makes sense that words like vivid and neon are at the top but i tis amusing to see anyway. Now it's time to do something really cool, we are going to make a graph with words at each vertex, and where vertexes are connected if there is a color that uses both words. Example: "bright red" would connect the bright and red vertexes. Here is the graph:

wordRelations=DeleteDuplicates[Flatten[Function[{fullName,color},Thread[{UndirectedEdge@@@Permutations[StringSplit[fullName],{2}],color}]]@@@data,1],#1[[1]]===Reverse[#2[[1]]]&];
namesGraph=Graph[DeleteDuplicates[Flatten[List@@@wordRelations[[All,1]]]],wordRelations[[All,1]],EdgeStyle->Rule@@@wordRelations,VertexSize->1,VertexStyle->name_:>LUVColor@@Mean[List@@@nameToColors[name]]]

Graph

Here edges are colored by the color that both words are mentioned in, and vertexes colored with the mean color of connecting edges. Next we can find communities in this graph:

communities = FindGraphCommunities[namesGraph];
CommunityGraphPlot[namesGraph, communities]

Communities

Finally we can do some coloring to see what colors are in these groups:

CommunityGraphPlot[namesGraph,communities,CommunityRegionStyle->Function[names,LUVColor@@Mean[List@@@Flatten[nameToColors/@names]]]/@communities]

Filled in

I may do some more with this data, if I do I'll post it here.

Random note: CommunityGraphPlot returns particularly pretty result when run over your final graph: Your graph

Attachments:

Poll data is probably a new thing, but maybe more appropriate would be the type of experiments done in psychology

Or already an old technology is eye tracking. Has anyone tracked the eyes as they see this color representation?

Back in 2004 Anirudh Tiwathia did an eye tracking experiment with cellular automata at the summer school which was later published in Complex Systems The experienced researchers would start at the bottom, but those unfamiliar always started at the top. In the case of Vitaliy's color visualizations I find myself looking through them in a definite movement, although I can't recall exactly what. From some perspective the eye movement is a more basic measure of semantic pathways than a poll, which is something that has to go through many layers and is more difficult to interpret.

POSTED BY: Todd Rowland

What a colorful Community post! :-)

Vitaliy, another way to have text in contrast is to use your trick posted in Stackexchange

text = First[First[ImportString[ExportString[Style["gray", Italic, FontSize -> 24, 
FontFamily -> "Times"], "PDF"], "PDF", "TextMode" -> "Outlines"]]];

and setting the fonts to be always black with white borders:

Graphics[{EdgeForm[Directive[White, Thick]], Black, text},
Background -> Gray, PlotRange -> {{-5, 25}, {-0, 20}}]

gray white borders black font

Btw, your awesome function to find color relationships can be used as a "Color Blind Assistant". Here is the modified function that does this given a color:

cassist[c_] := Part[Nearest[data, {c, ""}, DistanceFunction -> neco],1,-1]

for example:

cassist[Darker@Red]

"darkish red"

Which it really tells how that particular color looks like.

POSTED BY: Bernat Espigulé
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract