Do You Say Coke, Soda or Pop? A Map Visualization Shows Your Likely Answer

Posted by Elissa Fink on August 25, 2008

A good Tableau customer, Michael Cristiani of Market Intelligence Group, recently sent us a challenge. He had discovered a dataset for which people were surveyed about their choice of words for their preferred icy, carbonated beverage. Specifically, did they use the word “coke”, “soda”, “pop” or some other word? There were nice maps on the site but with Tableau 4.0’s new mapping capabilities, he wanted to know what we could do with the data. Given that I was in a hotel room when I read about this, I decided to give it a go with Tableau 4.0 (beats renting a bad movie) and came up with some interesting results.

I got the state-level data – ZIP code and County data as shown in the maps don't seem to be available on the site – and created two visualizations.

My favorite is the one below. It uses custom shapes of soda bottles (I’m from California so I say soda) I created (really just simple PNG or JPG files). The bottles are sized by the number of people who use each of the specific words. Different colored soda bottles represent coke (red), soda (blue) and pop (green). Pop, Soda vs Coke Visual Analysis Map

No surprise that Southeasterners (or what you could now call the “Coca® Cola belt”) have more people saying “Coke”. And Californians and Northeasterners say “Soda”. Midwesterners and Pacific Northwesterners say “Pop”. I was a little surprised by that last one – I moved to Seattle, WA about a year ago and hadn’t noticed people say “Pop” but a little testing with colleagues did show the truth of that.

I decide to look at the data another way: by pie charts on maps. That way in one map (rather than a small multiple containing three like above), I could see what proportion of the survey respondents said each of the three words. Pop, Soda vs Coke Population Proportion Data Visualization

Of course, you can plainly see the pattern described earlier. But this time you can easily see that places like Florida are a little torn between “Coke” and “Soda” (probably the influence of 2 distinct populations in Florida – true Southerners vs. relocated northeasterners and “snowbirds”). Virginia, Oklahoma and Kentucky which all border the traditional Southeast in some way are also somewhat divided.

If you want to give it a try yourself, here’s my packaged workbook. You could also get the source data at http://popvssoda.com:2998/stats/ALL.html.


Seattle Walkability

Posted by Robert Morton on August 21, 2008
Filed under: mapping maps tableau 4.0

I recently relocated to Seattle to join Tableau Software, and as I searched for a place to live I realized that I could dramatically reduce my dependence on driving. I used WalkScore.com to find a neighborhood with great access to restaurants, stores and a vibrant community. The attached Tableau visualization shows how lucky I am to live and work in Fremont, the Seattle neighborhood affectionately referred to as "The Center of the Universe!"

Seattle Walkability WalkScore.com provides a mashup of Google Maps and points of interest ranging from parks and libraries to restaurants and bars.  Given an address, they compute a score based on the variety and quantity of places you can reach on foot.  Lee Byron posted a cool visualization on his blog which aggregated data from WalkScore.com for a heatmap of San Francisco.  Using his tools I scraped data for Seattle and loaded it in Tableau to produce the attached visualization (download the TWBX). Green areas indicate the most pedestrian-accessible parts of town and you can see Seattle is dominated by walkable neighborhoods.

In fact, according to WalkScore.com, Seattle ranks in the top 10 most walkable cities in the United States. Fremont itself ranks in the top 15 neighborhoods in Seattle; personally I've reduced my driving to once a week, and I fill my car's tank less than once a month. While other locations such as the Edgewater Hotel and Pioneer Square score higher than Tableau's headquarters, it's only because the scoring algorithm doesn't consider accessibility to a giant Lenin statue, a glowing rocket or a troll under the bridge.


Sparklines on Maps

Posted by Richard Wesley on August 18, 2008
Filed under: lines maps marks sparklines

One of the exciting new features shipping with Tableau 4.0 is support for map based visualisations. You may have seen demonstrations that place marks such as shapes, circles and even pie charts on maps. But did you know that you can also put small line graphs called sparklines on maps? It takes a bit of work, but with this recipe you can do just that and visualise your own geographically arranged trends.

Background

In his book Beautiful Evidence, Edward Tufte talks about small X-Y graphs that he calls sparklines. Sparklines are very good at conveying time-varying data in a small area. Tufte's examples include things like patient glucose levels but you can probably think of your own uses.

One day last spring, I started thinking about how I could plot some of the time-varying climate data I play around with on our new maps. With a bit of effort (and some help from Jock Mackinlay) I managed to get it to work. Since then I've spent a little time perfecting the technique and now I'm ready to share it with the world.

Ingredients

In order to plot a sparkline, you need to know:

  •  what goes on the X axis
  •  what goes on the Y axis
  •  where each sparkline will go (the level of detail)

In my example, I will be plotting surface temperature anomalies from NASA's GISS project. Each record consists of a date (at month resolution), a latitude/longitude pair on a fixed grid, and the surface temperature expressed as a deviation from some baseline. In order to even out seasonal variation, we will average the anomalies for each year. So that means:

  •   YEAR([date]) goes on the X axis
  •   AVG([anomaly]) goes on the Y axis
  •   each sparkline will go at each [lat]/[long] grid location

Preparation

The key to putting sparklines is to create two calculations that "jitter" the underlying latitude and longitude fields. These calculations will then go on the X (i.e. Columns) and Y (i.e. Rows) shelves, while the location of each sparkline (i.e. latitude and longitude) goes onto the Level of Detail shelf. The sparkline itself is a Line mark with the X axis value on the Path shelf. I also find it helpful to put the Y axis value on the Color shelf to provide a kind of labelling for the axis, but this is not strictly necessary. You can also put a third variable on the Size shelf if the sparkline is not too dense, but I have not done that in this example because there are no unused variables.

I like to create these jittered calculations in two stages. The first stage is to make two calculations called [Sparkline X] and [Sparkline Y] that compute the X and Y  values for the sparkline and normalise them both to the range [-1,1].  This makes it easier to centre them on geographical points and scale them to the grid. These calculations should be aggregate calculations so that Tableau will not try to group by them, which would break the line up into a set of discrete points. In my example, the two calculations are:

  •   [Sparkline X] = (MAX(YEAR([date])) - 1980) / 30
  •   [Sparkline Y] = AVG([anomaly]) / 2

MAX (or MIN) is a convenient way to make a dimension into an aggregate without changing its value. Notice that each calculation is of the form

  • (AGG - midpoint) / (half of the range)

[anomaly] varies from about -2 to +2 in my data set so the midpoint is actually 0, and I am only going to plot YEAR([date]) from about 1950 onwards, which gives a range of about 60 years centred at 1980.

The second stage is to make the actual jittered calculations using two calculations from the first stage:

  •   [Longitude X] = MAX([long]) + [Sparkline X]
  •   [Latitude Y] = MAX([lat]) + [Sparkline Y] * .75

The .75 is used to scale the Y axis to the grid used by the data. The X axis seems fine with a scaling of 1 for my grid. Again, notice that these are aggregate calculations and I have used the MAX trick on the [lat] and [long] fields. For this type of visualisation, you should make sure that [lat] and [long] are Dimensions, not measures. Also, watch out for axis reversal - we tend to say "X and Y" and "Latitude and Longitude", but Latitude should have the Y values, not the X values! One final note:  If you create the Latitude/Longitude calculations by right-clicking on your [lat]/[long] fields when they are already marked with the correct geographical role, Tableau will create the new calculation with that role already assigned.

(Incidentally, splitting up the calculations this way is an example of what we Software Engineers call "separation of concerns": the Sparkline calculations are "concerned" with the properties of the X/Y values and the Latitude calculations are "concerned" with the properties of the grid. Then if you need to adjust something, you know exactly where to go to fix it.)

Baking

Now that we have everything ready, we just need to build the visualisation! (It may help to turn off automatic updates until the visualisation is ready.) Double click on the [Latitude X] and [Longitude Y] calculations to get them onto the Rows and Columns shelves. This gives us our map background. (Make sure that the appropriate Background Map is selected in the Data menu.) Put [lat] and [long] onto the Level of Detail shelf so that the lines are split up onto the grid. Choose the Line mark on the Marks card and put the X axis value onto the path (YEAR([date]) in my example). Now turn on automatic updates and you should have a beautiful set of sparklines on your map!

Garnish

As I mentioned above, you can add visual cues for the Y axis by putting the Y value onto the Colour shelf. In my example, this is AVG([anomaly]) and I edited the colour encoding to use 5 steps to make it easier to read. I also changed the default colour ramp to be a blue-red diverging because we tend to associate blue with cold and red with hot and the range is symmetric (like the colours).

Serving

And here is the final image:

US Northwest Temperature Anomaly Sparklines

I have attached a packaged workbook containing the example data and calculations for you to play with. The original data set is quite large, so I have created an extract containing only the data in a single worksheet.  Let me know how it tastes!

Nutritional Information

There is something interesting lurking in this example besides how to put sparklines on maps.  Have a look at the sparklines on the left of the map and compare them to the ones on the right.  Notice the costal marks show a much less pronounced upswing in recent decades.  This is because the ocean is a much better heat sink than the land (a fact that we here in Seattle are very thankful for in late July!)  It is also a nice graphical illustration of why the term "global warming" is being replaced by "climate change" in public discourse:  The warming is not uniform and is often affected by the local topography.  Looking at the full data set (which is sadly too large to include with this posting) there are a number of other patterns that jump out when one has the high data density afforded by sparklines.  I'll follow up if I find anything unexpected.


Sparklines - Easier Than I Thought

Posted by Elissa Fink on August 14, 2008

I recently had to look at a lot of data categories as their values moved through time. I wanted to embed these graphs in a Word document to succinctly and effectively provide visual context to my discussion points. I originally thought I would use one graph with multiple color-encoded lines but realized that it would not be very effective in my document. There were too many lines overlapping each other and you couldn't really discern what was happening for each category.

I remembered what Edward Tufte and Stephen Few recommend - sparklines - and used Tableau to create them quickly and easily.

Edward Tufte has excerpted a portion of his book Beautiful Evidence that presents sparklines, which is available here. To paraphrase, sparklines are simple, compact graphics which display a rich variety of information and are well suited for embedding in the flow of a larger document context.

Before Tableau, I had rarely used sparklines since creating small multiples of anything is hard work in most other analytical applications. Fortunately, Tableau makes creating sparklines (and other small multiples) pretty easy.

Below is an example of stock market data using sparklines. This set of sparklines shows the percentage change in stock price since August 13, 2007 for GE, Coca Cola Enterprises and IBM. The x-axis (representing 0% change) is represented to make it easier to see the percentage change.

Stock Price Sparkline Visualization

Creating a small multiple of sparklines is done in Tableau through a series of quick steps. Place the dimension for which you want a sparkline to appear on the row shelf, time (typically) on the column shelf and then the value on the row shelf after the dimension. Remove the axes (by right-clicking on each in the visualization and choosing the option to uncheck "Show Header"). Then use the size slider to make the line a little thinner. You probably then want to resize the row height by dragging one of the row dividers up. I also like to remove the axis lines and reformat borders (by using Format/Borders and Format/Lines from the menu bar).

Producer Price Sparkline Visualization

That's pretty much it.

One other thing I did is to color-encode the sparklines with the value just to drive the point home a bit more.


Tableau 4.0 Now Available - Mapping & Embedding Just 2 of the Major New Features

Posted by Elissa Fink on August 12, 2008

Tableau's 4.0 release is now available! This is no doubt one of our most significant releases. New features include one-click analytical map creation, usability enhancements to help both new and long-time users, and capabilities to embed and share live Tableau views with other applications such as Web applications, intranets and documents. Tableau 4.0 is available for download and a "new features" website has all the details.

Personally, my favorite new feature is the integrated mapping. I'm a long-time business analyst and I've used map creation and GIS products from MapInfo, ESRI and others. Tableau now creates maps without having to know much about map data or the science of mapping. But the cool thing is that all my analytics are in one application - a map is just another way of seeing and analyzing your data as is a bar chart, line graph, etc. So getting a new view on my data doesn't mean I have to go to another application - I just click a few times and my data goes from bar chart to map to table and so on. For example, below is a map I did in just a few minutes with some data from the Census. Net International Migration by County Census Data Visualization

As someone who needs to keep a whole slew of people informed as to the performance of our marketing programs, I also am digging the ability to embed visualizations and dashboards into other web applications. We're a Sharepoint house and most of the company is in-and-out of Sharepoint all day. So I now have my live marketing dashboards embedded inside of Sharepoint where I know my colleagues can easily find them and be 100% current.

And I have to say that another favorite for me is the new and very visual start page. Since I usually have very descriptive (long) file names, hunting through a text-based list of most recently used documents is tedious. But now, when Tableau opens up, I actually see thumbnails of my most recently used documents. So I can literally see the one I’m looking for in an instant and I’m off-and-running.

With nearly 60 new features in Tableau 4.0, I’m sure you’ll have your own favorites. So let us know what’s rocking your world and even what’s not. And, of course, we welcome your ideas and suggestions for what we should do next in Tableau 5.0.


Life Expectancy in OECD Countries

Posted by Jock Mackinlay on August 6, 2008
Filed under: data visualization

The Junk Charts blog had a posting about web publishing that included a comment by reader 'DavidS'. He suggested using quartiles in a chart about life expectancy in OECD countries. Since the data was easy to download, I explored his suggestion in Tableau. Although the original chart is a good summary of the upward trend of life expectancy, David is correct that a more statistical view showing outliers demonstrates that the variance has increased even though the range has reduced.

Since I was creating a statistical view, I decided to use a density plot to show the distributions by year. This also allows you to see when data was not collected for a given country.

Life Expectancy

And since there were more countries than an effective nominal color pallet, I used distinct color hues only for the low outlier countries. In Tableau, you can use the highlight feature of the color legend to explore the data for individual countries. The static view clearly shows that some outliers have moved significantly toward the mean.

As David predicted, the quartile markings (i.e., the small black lines) all show that the variance has increased even though the range has reduced.

You can explore further with the free Tableau Reader application (details / direct download) and the attached Tableau Packaged Workbook, which also includes trend line and map views of this data. JunkChart's original blog entry is available here and you can find David's comment here.