## Showing Trends over Time and Space? Use Small-Multiple Maps

Politics month is a perfect time to learn about small-multiple charts. They are a great way to compare various indicators without saturating a visualization or having one element taking precedence over the rest. Mike Cisneros already wrote a brilliant blog post on the value of turning a line chart into a small-multiple chart. I'll show you how to create a small-multiple maps, building up on a blog post by Chris DeMartini that Yvan Fornes brought to my attention.

If you're new to Tableau Public, don't run away! Small-multiple maps might sound difficult, but they are actually really easy. And I'm going to explain the whole logic behind them, so read along! At the end of your read, you'll be able to recreate this viz on out-of-wedlock births in France with the data I've made available here.

Ready? Let's get started!

## 1. Create the Generic Visualization You Want to Multiply

Import your data set, and make sure a geographic role has been assigned to your geographic data. Then start creating your generic visualization. Here, we want a filled map that shows the percentage of out-of-wedlock births per county. A double-click on the "County" dimension will create the map, and a right-click drag-and-drop of the "Proportion of births out-of-wedlock" measure onto Color will let you choose whether you want the percentage to be a sum, an average, or other aggregates. Here, an average would be the most relevant.

## 2. Create the Structure for Your Small-Multiple Chart

In this second step, we will calculate how many columns and rows we need as the structure for our small-multiple maps. There is a map for every year for years ranging from 1990 to 2013, which means: (2013-1990) + 1 = 24.

To have all 24 maps displayed in our visualization, we must have: number of columns x number of rows = 24. Note that this 24 is a nice number as it allows several combinations (8 x 3, 6 x 4, 12 x 2 etc).

Let's choose to have six columns and four rows, in which we will fit our 24 years. The table below will help you visualize the structure (with 1990 = year 1, 2013 = year 24).

To implement this structure, you will have to create three calculated fields (feel free to choose a name that speaks to you):

- "Ranking years": ranging from 1 to 24, where 1 represents 1990 and 24 represents 2013
- "Structure columns": ranging from 1 to 6, and using "ranking years" as a basis for calculation
- "Structure rows": ranging from 1 to 4, and using "ranking years" as a basis for calculation

### First Calculated Field: Ranking Years

This one is the simplest:

** [Year] - 1989 **

The logic?

### Second Calculated Field: Structure Columns

This one is also easy:

** CASE [Ranking years]%6
WHEN 0 THEN 6
ELSE [Ranking years]%6
END **

What's the logic? First, have a look at the orange table above to remember our structure: The first column contains years 1, 7 etc., the second column contains years 2, 8 etc. Now:

### Third Calculated Field: Structure Rows

This is a bit more complex, but I'll explain the logic of it as well:

** IF [Ranking years]%6 = 0 THEN [Ranking years]/6
ELSE ((6 - [Ranking years]%6) + [Ranking years])/6
END **

Have a look again at the orange table: the first row contains years 1 to 6, the second row contains years 7 to 12 etc. Now:

### Move the Calculated Fields

Drag and drop the three calculated fields you've just built from measures to dimensions. We want to avoid Tableau Public trying to sum or average those precious calculated fields.

### Check Your Work

Make sure your structure works. Open a new worksheet. Drag and drop "structure columns" on Columns, "structure rows" on Rows, and "ranking years" on Text. If you get a table similar to the orange one above, you're only 30 seconds away from victory.

## 3. Add Those Structure Fields to Your Generic Map

Now comes the moment of truth! Go back to the map built in the first step. Drag and drop "structure columns" on Columns (before Longitude (generated)), and "structure rows" on Rows (before Latitude (generated)).

What do you get?

Small-multiple maps can be useful to show the evolution of votes in a given country. As a matter of fact, I wrote this tutorial with this small-multiple visualization by the *New York Times* in mind. I was thinking how interesting it would be to visualize French votes for right-wing parties over time and space.

Hope this gives you some inspiration for the ongoing second Iron Viz feeder contest using politics data!

*Got a viz or a tip you'd like to share? Share them in the comments below or tweet them to us @tableaupublic using the hashtag #PoliticsDataMonth. *

## Comentários

## To avoid logical branching we

To avoid logical branching we can use simpler formulas like:

Structure Rows: CEILING(([Ranking years])/6)

Structure Columns:([Ranking years]-1)%6+1

## Jade,

Jade,

In your example, you show "1990" and "2013". How was that done, and is there a way to add the year to each mini-chart automatically?

Thanks!

## The logic for Third

The logic for Third Calculated Field: Structure Rows is too complicated, you can use this instead:

IF [Ranking years]%6 = 0 THEN ([Ranking years])/6

ELSE FLOOR([Ranking years]/6) + 1

END

Basically, if the value is multiple of 6, the division of it by 6 is the row number, otherwise add 1 to the floored division.

## I love this mapping. Is there

I love this mapping. Is there a mechanism to import shape files directly from ArcGIS??