EPIC Layers: Using Map Layers to build Epic the Musical
I have been listening to the music of Epic obsessively over the past six months, so I thought: why not make a viz of it! I love using Spotify data, so it was easy to get the data. But, since it is so easy to get the Spotify data, I’ve done a few vizzes using Spotify data, and I wanted to try something new. That “something new” ended up being this 2/3 circle, above, built all in one sheet (except the sliders). Here’s the step-by-step on the build, and how I used map layers to get this “Epic” build.
This viz is 13 concentric circles; the first circle is a marker for the song. The next ten will indicate the metric (dancebility, happiness, etc.) on a scale of 0–100. Then there is a circle for the most popular song, and finally the outer green circle. Here are the steps to build that.
Be sure to download the viz to follow along the steps: https://public.tableau.com/app/profile/nicole.klassen/viz/EPICTheMusical/EPICtheMusical
Step 1: You can’t do anything without data. To pull basic data from the Spotify API, I like using https://www.chosic.com/spotify-playlist-analyzer/.
Step 2: I knew I didn’t want the songs evenly spaced around the circle. Instead, I wanted the gap between the dots to be the length of the songs; so there would be a larger gap between two songs if it was a long song, and smaller gap for a shorter song. To do this, in the data, created a column that was the running total, in seconds, of the songs. This came out to being 8553 seconds for the entire album.
Step 3: To get the circle look, you need an angle for all 8553 seconds. First, in a separate sheet, create a column with the values 1 through 8553, for a total of 8553 rows. Since I wanted a circle around 2/3rds of a circle, I did (365*2/3)/8553, which is 0.0284. Place that value in the first row, and then do a running total all the way down to 8553. Now you have your angles; you do need to then reverse the order (so largest angle is on top) or your circle will come in inverted.
Step 4: Bring those angles back into the original data sheet. You can use a VLOOKUP, matching on the Running Total column.
Step 5: We’re ready for Tableau! You’re going to bring in both this original sheet with all the Spotify data, and the sheet that just has all 8553 angles.
Step 6: You’re ready to build your circles. First, you’ll want to set a parameter for your radiuses. You will need 13 radius parameters for the 13 circles. You can start with the smallest one around 13, and then each additional one will just be one bigger (so in this case, Radius 1 is 13 and Radius 2 is 14).
Step 7: Create the data for the map layers. Map layers are all about plotting x/y coordinates, so we need to create x/y coordinates! We’ll do that with our angles that we created in the Excel file. We are going to need another 13 X coordinates, and 13 Y coordinates, to create our 13 circles. The X coordinates will use COS() and Y coordinates will use SIN(). Be sure to include the correct Radius in each calcuation; otherwise your circles will all sit on top of each other.
Step 8: Create the final “Makepoint” formula for each circle, using the appropriate x/y coordinate.
Step 9: Now you just need to bring all the makepoint calculations out onto the “map.”
Step 10: Add in the coloring. On the outer circle, you’re going use every point from the “angles” tab in your Excel. However, we want the dot that is the start of the Saga to be white, and everything else green. So you’ll use an LOD to find the lowest running time per saga, and compare that to the main Excel.
Then place that on color. Note: the “Equal” is white, but the “null” is actually a transparent color. You can create a transparent color palette by editing your Preferences.tsp file and adding a transparent color palette with the hex code ffffff00.
Step 11: Color the metrics from 0–100. We want the dots in the circle to only show up when the value is that within a certain range. For example, if a song has danceability of 40, we want the first 4 circles to show a dot, but the last 6 will be transparent. You do this by creating a color calcuation for each circle.
Step 12: Adding in the Popularity metrics. Just like the outer green circle, we want the most popular songs by saga. So we use an LOD.
Step 13: Set up the slider. The “select a metric” variable used in the color calculations is based on a parameter to select the metrics you want on your slider.
The slider is set up with it’s own sheet, and uses a parameter action to change the x/y coordinates of the sliders. So, if Happiness is selected in the parameter, then the x/y coordinate of the line is 3,4. However, if Energy is selected, then the x/y coordinate for Happiness will be 3,0. Then you just need to set up a parameter action so that when you click a slider, the parameter update.
And there you have it, and Epic viz with Epic map layers!