How to Animate a Map with Flourish Stories
How to Animate a Map with Flourish Stories

How to Animate a Map with Flourish Stories

I recently worked on visulizing data on a US map. Usually maps are a type of a heatmap showing data values using a certain color and different color hues. In this example however I am using different colors and instead of data values I am using categories applied to each location. Using Flourish stories I was able to build a timeline using a map. This map shows how Cannabis legalization in the US started by state. The data values in this example are categories: Illegal, Decriminalized, Legal for Medical Use, Legal for Recreational Use. The map changes and applies different colors as the data value changes throughout the years.

In this post I will show you step by step of how I created this animated map.

Data Structure in Flourish

This map is built fom data that contains 6 different time periods. Here is how the data spreadsheet is structured in Flourish for the first map that shows the period between 1978 – 1999.

The geometry and the state name are default components from the Flourish map template. I included the cannabis legal status in column C to use as the value. In this time period there were several states that had decriminalized marijuana and everywhere else it was illegal.

Using the same data structure I created 6 different maps for each time period. To make this project more organized I created a folder in Flourish to host all of these maps and used names for each map like Map 1, Map 2, Map 3, etc.

Each of these maps contain the data for the different time period. For example here is the data structure on Map 2:

In this example we are looking at the year 2000 and what has happened related to marijuana legalization from 1999 to 2000. In this map instance we see one more componenent added and that is cannabis being legal for medical use in several stated, decriminalized in a few others and still illegal in the rest.

Styling the Maps

Flourish offers some very interesting features to enable the styling of any data map. This map looks at US states which in Flourish are styled under regions. In the fill area I chose Categorical scale typle since the data values are not numerical but categorical. You are able to choose your own colors and overwrite the default colors.

Flourish region styling on a map
Flourish Color overwrite

In the data tab I chose column C, or the column where my categorical data values are, to be a meta data for popups.

Popup settings is what would appear and your audience hovers over and clicks on your map. Region name will appear by default and whatever you specify to be the popup metadata will appear next to the name of the region. In this case for my map I am enabling my audience to click on a state and see state name and the legal status of cannabis.

Other styling options that I implemented was to disable the search bar, include a title and a subtitle and I also had to overwrite how my legend appears. Flourish offers you the option to put on each of your charts your choice of legend order. Since I am using categorical data values these did not always come in the same order on all of my maps so I had to manually insert this on all the map to make sure they match.

Creating a Flourish Story to Make the Map Animated

Once I had all maps created I put them all in a story starting with my Map 1 and followed by the other maps by number. Once all maps have been added, I exported and published my story. You can see it here or below. Clicking on the arrow at the top moves to the next time period.

Creating a GIF

Using Screen O Matic software I recorded a video while browsing through the Flourish story, (clicking on the arrow). Then I saved the recording as a GIF which created this animation. You can use this approach on all sorts of chart to create similar animation. I have another Flourish story that animated a line chart over a certain period of time:

Flourish have a great blog post explaining how to do this.

Related Resources

Line Chart Examples
The Violin Plot

Leave a Reply

Your email address will not be published. Required fields are marked *