United Hexagons of Waffles

A few folks asked me how I made these waffle charts:

hexwaffles

https://public.tableau.com/profile/jake.riley#!/vizhome/HexWaffles/HexWaffles

Well, first, the inspiration comes from a conversation with Pooja Gandhi (@DrexelPooja)and then her collaboration with Tom O’Hara (@taawwmm) and Pratima Bhanu (@drawwithdata). Together, they took waffle charts like this

waffle

and tile maps (via Brittany Fong)

tilemap

and made this beauty:

gridwaffles

It looks great and Twitter loved it. I was curious about the challenge of creating something similar to the hex tile map by Matt Chambers as shown here and I decided to tackle it using R.

hexgrid.PNG

Matt was nice enough to put a link in his tutorial to the underlying dataset that creates this map.  I used his hexagon coordinates as the starting point and then used R to build a 5,151 point scatterplot. (51 state hexagons + 51 x 100 small waffle tiles).

Once I brought the points into R, I used the center of each hexagon to create a waffle grid:

offset points.PNG

I then made a quick mockup using the ggplot2 library. I used overlapping circles to approximate the hexagonal space I would have to work with once I brought it into Tableau

rmockup.PNG

Looks good. Once I brought it into Tableau, I was able to arrange it like this:

tableau setup.PNG

It is essentially a single axis, 2-shape scatter plot. Notice that [Type] is controlling both the shape and the size. It is the shape range that really allows this method to work.

I used this structure for the calculated field that controls [_which color]:

IF [Type] == "Hex" THEN "Hex"
ELSEIF [Tile] > [_fake data] THEN "Unfilled"
ELSEIF [criteria1] THEN "Filled-"
ELSEIF [criteria2] THEN "Filled+"
END

The dataset can be found on this Google Sheets tab and the R script is available on my GitHub.

I hope this brings some inspiration.

Happy vizzing.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s