Visualmotive Blog

Thoughts on maps and visualization

Color Sorting – Python source code

I have had several requests for the Color Sorting code I used to create these images. The pixel-based color sorting uses linear and Hilbert sorting techniques in RGB, YIQ, and HSV color spaces.

So now, ColorSorting is now on Github.

The code is not polished, so use at your own risk. Enjoy!

Feb 3, 2010Leave a comment

Understanding Comics by Scott McCloud

The process of writing comics

The process of writing comics

What follows are notes and quotations from Scott McCloud’s excellent book Understanding Comics. The book describes the art of comic books, but most of the lessons are also applicable to other types visual communication like charts and maps.

Definition: “Comics are juxtaposed pictorial and other images in a deliberate sequence, intended to convey information and/or produce an aesthetic response in the viewer.”

Comics use iconic images: sparse representations of reality. Used to allow the reader to inject himself/herself into the narrative.

McCloud's triangle of communication. Photographs on the left, written word on the right, abstract icons on top.

McCloud's triangle of communication types. Photographs on the left, written word on the right, abstract icons on top.

Most comics are along the bottom axis of the triangle (above), but there are examples of comics that fill the whole space.

Comics allow people to identify with roles and characters. “People in the 20th century don’t want goals, they want roles,” by McLuhan (1970?).

Closure: observing the parts, but perceiving the whole. Like seeing a character’s torso and knowing he has feet. For example: videos are a rapid sequence of stills, or rich color photos that are a bunch of little dots (like newspaper prints or Roy Lichtenstein).

The gutter: space between panels where the imagination works.

Visual icons are vocabulary, closure is the grammar.

Types of transitions:

  1. Moment to moment (same character and scene)
  2. Action to Action (single subject)
  3. Subject to Subject (same scene)
  4. Scene to scene (different characters and scenes)
  5. Aspect to aspect (different aspects of a place or idea)
  6. Non-sequitur (no relationships whatsoever)

How time works: divided panel by panel:

  • Panel shape influences perception. Longer panels seem to occupy more time.
  • Timelessness: long, lingering time. Usually borderless panels or those that bleed off the edge.
  • Passage of time can be shown with “zip ribbons” (swish of motion).

How lines influence communication:

  • Different types of lines can have different emotional and sensational qualities: passive and timeless, proud, dynamic, severe, gentle, etc.
  • Subjective motion (subject is static, looks like the background is moving)

When thinking about the interplay between words and images in comics, there are several Word + Image combinations to consider:

  • Word specific (words are dominant)
  • Picture specific (pictures are dominant)
  • Duo-specific (both words and pictures convey the same meaning)
  • Additive (words add significant meaning)
  • Parallel (words and pictures tell different but parallel stories)
  • Montage (words are integral to the picture)
  • Interdependent (both work together to tell a story neither could tell alone)

Process of creating comics (see image at the top of this post):

  1. Idea/Purpose
  2. Form
  3. Idiom/style
  4. Structure
  5. Craft
  6. Surface

What about Color? Color symbolizes certain characters (eg. Batman is always blue-gray). Flat colors emphasize the shape of an object (Herge’s TinTin comics used all flat colors) to promote a democracy of form in which no shape is any more important than any other.

——————————–

Those are my notes. If this sounds interesting to you I highly recommend reading the entirety of Understanding Comics. It’s delightfully crafted and a pleasure to read. Also, Scott McCloud writes on Twitter and on his blog.

Dec 9, 2009Leave a comment

Notes on Color

Munsell Color Space. Image created with POV-Ray, CC license via Wikimedia Commons

Munsell Color Space. Image created with POV-Ray, CC license via Wikimedia Commons

Choosing colors for maps, charts, and infographics can be a difficult task. Standard software packages like Excel and Matlab have tended to offer substandard color schemes (though this is getting better) so it’s up to the designer to learn about color and apply the appropriate techniques.

This post will focus on color schemes for maps. There are several types to consider:

  • Sequential – good for quantitative variables.
  • Divergent – good for quantitative variables with an obvious midpoint (e.g. zero) and two divergent tails.
  • Qualitative – good for categorical variables.

Given a sequential, non-divergent color scheme, Cynthia Brewer and Mark Harrower (of ColorBrewer fame) note:

Lightness steps dominate the look of these schemes, usually with light colours for low data values and dark colours for high values. ‘Dark equals more’ is a standard cartographic convention. Sequential schemes can be either single hue (e.g. same blue, with different lightness and saturation levels) or multi-hued (e.g. light yellow through dark green).

Background

It’s important first to remember that computer displays and common digital color formats (like RGB) only show a subset of all visible color. It’s also good to be aware of some common color spaces: RGB, HSV, and YIQ.

RGB identifies color by red, green, and blue components. HSV uses hue (angle on the color wheel), saturation (intensity of color), and value (amount of black). YIQ is used for NTSC television signals. It has a black/white component plus two chromatic components; the black/white Y component is what is visible on a black and white television.

Much experimentation has been done on how people perceive colors. Assuming colors are at equal saturation. “Value perception dominates color perception.” (Bertin, p 87) Images generated earlier on this blog tested color sorting across every variation of RGB, HSV, YIQ color spaces and confirm Bertin’s assessment.

Bertin writes, “The saturated tone is not of constant value but varies in value according to the hue.” This makes sense. For example, yellow at 100% saturation is much brighter than blue at 100% saturation. If yellow and blue are to be used in the same color scheme, we will need to compensate for the perceived brightness of the yellow by decreasing its value.

Munsell Color System

Enter Albert H. Munsell. In the early 1900’s he undertook a lot of research to understand exactly how it is people perceive color. The resulting Munsell Color System is a three-axis system that doesn’t conform to any standard spherical/cubic geometric model.

Munsell Color System diagram. CC license via Wikimedia Commons.

Munsell Color System diagram. CC license via Wikimedia Commons.

The central axis indicates the perceived value (darkness/lightness) of the color. The angular values indicate hue, and length out from the axis is chroma (intensity).

When choosing colors for maps and other diagrams that utilize a linear, quantitative scale, the Munsell color system would be a good place to start. ColorBrewer has great color schemes for maps, and all of them have proven perceptual merit. ColorBrewer is a great resource and I have used it in many projects. The only real issue with ColorBrewer is that it contains so few color schemes. Sometimes a designer wants to be able to match the brand, identity, or theme of a larger project while maintaining the integrity of the diagram’s visual communication. Working with the Munsell system should allow just that.

Looking forward

We have not tested this yet, but one could choose a particular hue + chroma in the Munsell system as a starting point, and work up and down the axis to find related colors that vary on perceived value. Additionally, one could move in a diagonal fashion, moving up in value while also moving an angular increment around the axis. This would theoretically accomplish the multi-hued sequential schemes that Harrower and Brewer describe in their paper on ColorBrewer (quoted above).

Potential Munsell color schemes compared with schemes from ColorBrewer

Potential Munsell color schemes compared with schemes from ColorBrewer

References

Jacques Bertin, Semiology of Graphics. Translated 1983 by William J. Berg, originally published in 1967.

Mark Harrower and Cynthia Brewer, Colorbrewer.org: An Online Tool for Selecting Colour Schemes for Maps. The Cartographic Journal, Vol 40, No 1, pp 27-37. June 2003. [PDF]

Munsell Color System, on Wikipedia. Associated images at Wikimedia Commons: POV-Ray render and the color system diagram.

Bruce MacEvoy, Modern Color Models. 2005.

Dec 7, 2009Leave a comment

Walk or Bus?

Should you walk or take the bus?

Should you walk or take the bus?

It is intuitive that when you have a short distance to travel it is always faster to walk than wait around for a bus. But exactly how long should you wait? We decided to do some calculations to find out.

Click here to see Walk or Bus? and discover for yourself how long you should be willing to wait for a bus.

If you remember this rule of thumb you ought to get along just fine:

If you have N blocks to travel, you should only wait for the bus if it is less than N minutes away.

Of course, if you have a bike, you should probably use that instead. :-)

Feel free to leave your questions or comments.

Link: Walk or Bus?

Sep 28, 200913 Comments

Sorting Colors

Color sorting using RGB, HSV, and YIQ color spaces

Color sorting using RGB, HSV, and YIQ color spaces

We recently needed to sort the pixels in an image by their color. On first attempt, we sorted by simple RGB values: first sort on R, then on G, then B. But it turns out there are many other possibilities for sorting colors. Every permutation of the RGB letters could be considered (RBG, GBR, GRB, etc.), not to mention other color systems HSV and YIQ.

To see all the color sorting possibilities, we wrote a Python script to try every permutation against a common set of source images.  Click here to see every color sorting option. Note that we use a Hilbert curve in the top set of images to provide better grouping of similar color values. The bottom set of images is linear and wrapped: left to right, then top to bottom.

Our goal was to find a sorting mechanism that looked pleasing to the eye, but of course the results are completely subjective.

  • For aesthetics, we prefer the YIQ sort. It highlights trends in value change, but information about hue variation is hidden and sometimes invisible.
  • To communicate more information about hues, HSV sorting is by far superior, but it lacks the pleasant gradient-effect of the YIQ sort.
  • RGB sorting proves inferior to HSV and YIQ, though the results can still be interesting.

Also worth noting: HSV sort is excellent for grouping colors of similar hues, but the IYQ and YIQ sorts also do this well and they can look cleaner than their HSV counterpart.

(with thanks to Steve Witham for his Hilbert curves in Python.)

Sep 14, 2009Leave a comment

Graph Visualization with Edge Bundling

US air transit routes after bundling algorithm was applied

Diagram of US airways using Holten and van Wijk's bundling algorithm

We recently encountered (via infosthetics) a paper from Danny Holten and Jarke J. van Wijk that demonstrates an algorithm for creating beautiful graph visualizations. The original paper is Force-Directed Edge Bundling for Graph Visualization, published in 2009.

In computer science theory, a graph is a collection of nodes and the edges between them. Graphs are useful abstractions for describing transit networks, computer networks, and relationships among people (such as in a social network). Over the years mathematicians and theorists have discovered that there are hundreds of additional problem types that can be rewritten as graph theory problems. So, understanding and visualizing graphs is important for a large number of problem domains.

While there are many ways to represent a graph visually, the most intuitive is to draw a set of points (nodes) with lines (edges) connecting them. The goal, of course, is to make the visualization intuitive to understand for a human observer. The visualization should be functionally readable, aesthetically appealing, and ideally should allow an observer to glean interesting information about the graph’s structure. For larger graphs, several issues regarding visualization immediately present themselves. First, nodes must be laid out such that they to not interfere with one another. Edges should be drawn so that they can be distinguished from one another, with minimal crossing, but should also connect two nodes with the shortest line possible and minimal curvature. Node size and edge thickness become important, and either nodes or edges are connected to real-world space, they should be placed in some analogous fashion.

Unprocessed visualization of a graph depicting US airways

Unprocessed visualization of a graph representing major US airways

Holten and van Wijk have introduced several novel ideas to graph visualization theory. Their main contribution is the grouping of similar edges using a clustering technique. Edges become flexible springs that can attract and repel one another. While other researchers have proposed edge-bundling techniques, Holten and van Wijk’s algorithm uses a “self-organizing” approach that does not require additional information in the form of control hierarchies or meshes as did previously published algorithms. By transforming the edges into springs, they are able to leverage existing algorithmic techniques for modeling real world systems. Read the rest of this entry »

Jul 13, 2009Leave a comment

Jason Salavon

salavon_house_series

Salavon's photograph series Homes for Sale. Clockwise, from top left: Seattle, Miami, Los Angeles, New York City, Dallas, Chicago.

We find the work of Jason Salavon highly inspirational. At the intersection of art and visualization, his images are distinctive for their surface and immediate graphical language while also communicating significant stories of process and history.

By merging dozens or hundreds images that share some common theme, Salavon helps us extract high-level information about common form, texture, and color. The details are sacrificed, but we gain understanding of patterns inherent in the larger series.

In the Homes for Sale s images, aggregation is done by place and time. The photographs, all from 2002, were taken by realtors. We might expect different results in different cities, years, or seasons. As it is, we can see the green grass of Dallas contrasting with the yellow lawns in Chicago, and the blue skies of Miama and Los Angeles stand out against the gray atmospheres in Seattle and New York.

Every Playboy centerfold, by decade. From the left: 1960s, 1970s, 1980s, 1990s.

Every Playboy centerfold, by decade. From the left: 1960s, 1970s, 1980s, 1990s.

In the Playboy series, aggregation is achieved by limiting the kind of image (only centerfolds) and differentiating by decade. We see artifacts of culture in composition and colors, warm to cool, with lighter skin and hair emphasized in later decades.

Hiroshi Sugimoto, Akron Civic Theater, Ohio (1980)

Hiroshi Sugimoto, Akron Civic Theater, Ohio (1980)

We can think of Salavon’s photos as 2D films, where all frames are merged into one static image. Similar work has been done by the brilliant photographer Hiroshi Sugimoto, who’s camera has captured the entirety of feature films with one long shutter (above). Sugimoto does not wish to tell us about the film itself—in fact, the film title is never announced—but rather about qualities of light, surface, shape, form, and so forth.

Most data visualization projects start with structured data, spreadsheets, XML, databases, APIs. We like Salavon’s projects that bridge data visualization with more traditional media, using a raster imagery as the data sources, extracting patterns and meaning from highly unstructured content. They are beautiful in their own right, and serve as an inspiration for future data visualization projects.

Mar 26, 2009Leave a comment

Song Visualizations with Echo Nest

Philip Glass String Quartet #5, 2nd Movement

Philip Glass String Quartet #5, 2nd Movement

We recently came across Anita Lillie’s beautiful music visualization and MusicBox projects. The music visualization project was especially intriguing to us, since it was the only music visualization project we’d seen that did not require video playback—the visualizations were strictly in 2D. Unfortunately, the source code for Lillie’s visualizations was not available, so we decided to build our own.

Our goal was to build a 2D visualization that could be approached like one of Edward Tufte’s sparklines: a quick, snapshot overview with high information density. In addition, having an image snapshot of a song could be useful for visually-minded people who often find themselves thinking of music as in spatial or pictorial terms. In the same way that Cicero used different rooms in his home to memorize different sections of his oratories, a 2D song-picture could provide a memorable structure for interpreting and contextualizing moments in a piece of music.

Here is the fruit of our labors. The top segment represents volume across the duration of the song. The bottom segments represent the 12 pitches of the song’s primary key, and the weight of each block corresponds to that pitch’s volume at that point in the song. Details, including Echo Nest integration and source code, are below.

Pink Floyd, Dark Side of the Moon, "Speak to Me/Breathe in the Air"

Pink Floyd, Dark Side of the Moon, "Speak to Me/Breathe in the Air". The opening crescendos of this album are clearly visible.

Crystal Method, Vegas, "High Roller"

Crystal Method, Vegas, "High Roller". We like the seeing that perfect volume curve at the beginning of this song. There's a pronounced industrial feeling here.

John Williams, Star Wars: A New Hope, "Imperial Attack"

John Williams, Star Wars: A New Hope, "Imperial Attack". This visualization should probably be in black.

Goldfrapp, Supernature, "Ride a White Horse"

Goldfrapp, Supernature, "Ride a White Horse". Volume leveling clearly visible. Pop at its finest.

Mozart, Requiem, "Kyrie"

Mozart, Requiem, "Kyrie"

George Maasry, "Permutations"

George Maasry, "Permutations". Mathematical permutations on a theme.

Read the rest of this entry »

Mar 19, 20095 Comments

Painting Supernovas

Supernova Zoom

A. Visualizing a star's death

Christopher Healey and his research team have developed a painterly approach to data visualization. His software correlates dimensions of multivariate data to dimensions of visual sensation. The results are stunning and have both artistic and scientific merit.

In the images shown here, Healey’s software has been turned to the task of visualizing data from the explosion of a dying star. His colleagues at NCSU record three-dimensional timesnaps of the supernova, then investigate that data by looking at two-dimensional slices. These slices, at a 500×500 resolution, carry information across the variables of velocity, magnitude, pressure, and density.

The following mappings are in use:

  • magnitude → color
  • density → stroke size
  • Δx and Δy → stroke orientation
Supernova

B. Flow and energy in a supernova

Continuity of strokes (image B) indicate a continuous flow, but sharp contrasts in color or orientation (note the right side of image A, at the edge of the shock wave) suggest discontinuties and a swarm of vortices.

Healey and his team have been working on painterly visualizations for several years. His website is flush with papers and examples of how this approach can often yield useful and beautiful results. In particular: Engaging Viewers Through Nonphotorealistic Representations (PDF).

Mar 10, 2009Leave a comment

Feltron Annual Reports

Map and timeline from the Feltron 2008 Annual Report

Map and timeline from the Feltron 2008 Annual Report

The Feltron Annual Reports are brilliant personal visualizations that describe, one year at a time, the life of Nicholas Felton. He uses an elegant combination of textual manipulation, charts, and diagrams to convey interesting and sometimes trivial facts about his life.

We learn that the subway fees are 93 cents on the mile, compared with 536 cents/mile spent at the gym (unclear whether this is on a treadmill, elliptical, or stationary bike). Bradford Cox, Radiohead, and Daedalus fill out most of the “music heard” pie chart. A set of flags clipped to map sections show us unique locations, and below the maps, a timeline correlates personal life events with global and national affairs.

Annual reports dating back to 2005 are available at feltron.com.

Mar 7, 2009Leave a comment