Showing posts with label DataViz. Show all posts
Showing posts with label DataViz. Show all posts

Top 50 Domestic Box Office Movies each year from 1996-2016

Top 50 Domestic Box Office Movies each year from 1996-2016
I collected and analyzed the Top 50 Domestic Box Office films each from 1996-2016 using IMDB.com and Parsehub.com. While playing around with the data, I had the idea to focus on Genre, on how films connect between them. For example, an Action-Comedy, of a Romantic-Comedy. I had the idea for a Circular Network Diagram, similar to a Chord, minus the Curves and the % of Total Aspect. I will update this post this weekend with the How-to.



A Christmas Carol Text Analysis

A Christmas Carol Text Analysis
Happy Holidays everyone. My wife and I have been on a binder watching Holiday Movies lately, which means I've seen about 5 renditions of A Christmas Story (A Muppet Christmas Carol is still my favorite). So I thought it would be fun to do a viz on it. I got the data online using Parsehub.com and did a lot cleaning in Excel to get it usable for analysis. I haven't done much with Text analysis, but one thing that I have learned so far is getting rid of Stop Words (Common words like A, The, Is, Etc.) can help. So I got a list online and left joined it to my data so I could take them out. Interactive viz below


I'll write up how I created this viz (particularly the Radial) in another post. Shout out to Matt Chambers for great feedback.

How to Sigmoid Bump Chart (Spline?)

If you follow me or my blog, you probably know that I am partial to the curve. I particularly love the sigmoid function, I don't know why, I just think it looks cool. One of the things I've been playing with lately is incorporating multiple sigmoid curves into the same chart. I've done this before in my Batman viz as a Parallel Coordinates with Smooth Transitions but I haven't had the chance to really unleash a sigmoid fully across a viz. The other day I was looking around and "bumped" into Matt Chamber's fantastic viz on the Car Color Revolution in North America. I was looking at it, and it hit me, I can use the Sigmoid curve between these points, giving it a smooth transition feel. Product below


I think it came out nicely, but I had to use a few tricks to make it work.

The how

First things first, as I always do, if you are not familiar with the Sigmoid Curve in Tableau, I recommend checking out Chris Love's tutorial on Sankeys. I'm sure he loves how much I reference it :)

In order to create the Sigmoid Curve, we need to define a [T]. For the Curve, this is a range of values from -6 to 6 among 49 points. So we need to generate 49 points for every record. There are a few ways you can do this, one is to use Chris' method of Unioning the Datasource and then leveraging Densification, the other is pre-processing the points and cross-joining it to the source. I chose the latter for this demonstration. So to begin, we need to look at the data.


As you can see, the data itself is not very complicated. It is simply one record for each Color and Year, and the Rank of that color. There is also another field Called Join, that has a value of 1 for every record. We need this so we can "Join" it to our Padded Table. See Below


By creating a Sheet with 49 points and a field with equal values, we can Join them in Tableau and create a cross-product of the results. This is how we create a Full Join, even though Tableau doesn't "support" it. Come 10.2 this will be made even easier because you will be able to create a Calculated Field in your Source, and join on that. That in combination with Cross Database join means we can full join tables with no backend interactions.

Once we have joined these in Tableau, we effectively multiply our dataset by a product of 49. Each record now has 49 points. So our next step is to calculate our [T]. This is actually a very basic calculation, in fact we could have pre-generated this in Excel.

[T] = ([Path]-25)/4



Next we need to generate consecutive points across the 16 years of data. To do this we calculate an index across the years. 

Year Order = [Year] - {MIN([Year])}

For this dataset (Beginning with year 2000) we could have stripped out the 2 years with a string parse, but I used this method to show that it can be done with any years, i.e. 1996-2014. This will effectively give our years a Range from 0-Max Year Count. We can now leverage this in a calculation to spit out our consecutive rows.

Path Order = (49*[YearOrder])+[Path]


Awesome, making progress. So we have our [T], and we have our consecutive marks, now for the hard part. In order to leverage the Sigmoid function we need to set a Start and End Value. The Start is easy, it is just our Rank. But the End Value is where it gets difficult. We need to figure out, for each color, what it Ranked in the next year. This isn't that big of a deal, except for the fact that added 49 records for every Color, Year combination, so we have to use Table Calcs.

Step 1 is to isolate the two points that change on a color. For us that is Point 49 (The next point would be 1, which is a new year, new rank).

[Rank 2 Setup] = 
IF MIN([Path]) = 49 THEN LOOKUP(MIN([Rank]),1) END

Here we are telling Tableau if the Path = 49, lookup the next rank in order, which would be 1, or our next year's rank. The key to this is have it restart every color.


Once we have this, we can now take that mark and make it repeat for each year and color. This will be our Rank 2

IFNULL(WINDOW_MIN([Rank 2 Setup]), MIN([Rank]))

Essentially what we are doing is taking our Next Rank for Color, and repeating it along the entire 49 points. This gives us a value we can use to create the Curve function.


Sweet, now we have our Rank, our Next Rank, and a consecutive path order, now we actually create the Curve.

[Sigmoid] = 1/(1+EXP(1)^-[T])

*Edit thaks to Alexander Mou for a more consice Sigmoid*
1/(1+EXP(-[T]))

[Curve] = MIN([Rank 1])+(([Rank 2] - MIN([Rank 1]))*MIN([Sigmoid]))

Now we can plot it!


Nice! But there is still a little work to do. Mainly, I really don't like that X Axis, it doesn't make sense we need that to be in Years. Lucky for us, Year is just number, so we can just transform our points back to the "Year" level.

[YearFake] = ([PathOrder]/49) + 2000

Basically we are just reversing the calc we did before and adding 2000 to it. This will change are marks to be back on a 2000-2015 scale, with many Decimal points between it.


Now, we don't want those pesky decimals to show up, and we don't want years 1999 or 2016 to show up, so we use a little formatting tricks to help us out. One Fix the Axis to ensure 1999 and 2016 never show up on the chart.


After that, we just set our axis tick marks to show every 1 point, eliminating the risk of a decimal showing up.


Once that is done, simply add a Dual Axis for Path 1, and do some cleanup, and then you get the final product!


Geesh, kinda a lot to do something not that complex. I wanted to show this off and how to do it because I really think it is visually pleasing. I love Bump Charts, and this isn't taking anything away from it, just adding a little flash. As demoed at TC16, Jump Lines are coming our way, maybe someday down the line they can add a Sigmoid/Spline option. I guess time will tell, but till then, I hope this tutorial helped.

Regards,
Rody

The Atlantic Coastal Conference : A College Football Tradition

The Atlantic Coastal Conference : A College Football Tradition
A Data visualization of every football game played by Atlantic Coastal Conference teams. Data does not include games played prior to teams joining the ACC, or games after leaving the ACC. I collected the data viz JHowell.net , which is an incredible resource for College Football stats. I then used Parsehub.com to scrape the results, and some slight scrubbing in Excel.

Explore the interactive viz below


A History of Florida State Football

A History of Florida State Football
Data Visualization detailing the History of Florida State Football. With the exception of 2016, Chart contains every game FSU ever played in the Regular Season and Bowls/Championships/Playoffs. Data was collected from this amazing resource http://jhowell.net/cf/cfindex.html via ParseHub.com. I enriched the data using Excel to get Game Numbers, Remove Opponent's overall record, etc.

Go FSU!


Pixar vs Disney Animation Studios

Pixar vs Disney Animation Studios
Data visualization on Domestic Box Office for Pixar and Disney Animation Studios Theatrical Animated Films.

Data was collected via multiple Wikipedia pages and Tableau was used to Visualize. The Box Office numbers include Films that had multiple Theatrical Releases (Such as The Lion King). Explore the interactive viz below to learn more.


Feedback, Math and the Power of Tableau

Warning! Really long post coming.....And it is all about how I created this viz in a Single sheet.


Recently, I created a visualization on the Batman Film series, as well as, a brief write up on how I did it. You can find the viz and post here. It was an ok viz....but I felt like it wasn't great, and it was a pain to create, since I had to create a bunch of sheets and float them all together on a Dashboard. I wasn't sure what to do with it, so I sent it over to Chris Love and asked from some feedback. Chris is a Tableau Zen Master, and a phenomenal Data Analyst. Chris was kind enough to compliment the viz for its strengths, but also pointing out its weaknesses and make suggestions on improvements. One of these weaknesses was the Jump Plot, while it looks cool, it doesn't add anything to the analysis, and it is distracting visually as well. After thinking on it, I realized I was forcing it to be in my viz, even though the was no real reason for it (I can justify "curves" when it helps aid in the visual engagement, the Jump Plot was not doing that here). He also mentioned how it was difficult to read, the Text Descriptions helped, but should they be necessary? So with that, I decided to go back to the Drawing Board.

Now, there are some things I really liked about the viz, mainly, the Parallel Coordinates Esq feel to it, with Smooth Transitions via Sankeys. But I thought it would be easier to read if it ran Horizontally, instead of Vertically. Here is the rub, in the original viz, I created 5 sheets and floated them all together....I did not want to do that again. So, I decided to challenge myself and do the entire dashboard in a Single Sheet. And so the Drawing began!


I'm pretty sure no one can read this but me (Because of my horrible handwriting) but I'll break it down, and how I accomplished it in Tableau.

1. The very first thing I needed to do was figure out how many Marks I needed, this would give me a base for setting up my Bin. I wanted to the 3 Columns to have 100 Marks (I did this to make it easier to plot the Parallel coordinate, more later), and each Sankey would take 49. I did this so the Sankeys were visually less proportional to the Columns. The Sankeys weren't the story, there were just there for effect. So 3X100 + 2X49 = 398 Marks. To the data!


The data is pretty basic, really it is just 8 rows with a few measures. But what I do it double the data source and have a Column called Bin with Values 1 and 398. This is so I can setup a Bin to densify the data in Tableau (If you are lost, watch this video by Joe Mako). Now that I have my data prepped, off to Tableau we go! (Last note on this...you could also create a Scaffold Sheet with record 1-398 and then just Cross Join it to the main sheet. I chose to do it this way to push the Table Calcs necessary to build/keep densification. If performance was a must, I would have pre-processed every mark).

2. Now that I have the Data, it's off to build the Calcs! I already had an idea of how I could create them, but I needed to do prep calcs before I could continue. Since I was using Densification, I wrapped all of my measures in Table Calcs so nothing would break on me. Next, I created my Sankeys (Tutorial here) but I had to make some modifications on the Ranks and T. Since I was transitioning Points by Ranks, as opposed to Percent of Totals, I used WINDOW_MIN(MIN([Rank])) for each of my 3 ranks (Film Release, Rotten Tomatoes and Worldwide Box Office). I then went on to T.


Normally, [T] would be calculated as (INDEX()-25)/4. So since we are doing 2 Sankeys at different points in the Lines, we need to break them out conditionally. My first 100 Marks is for Film Release, so I start the Sankey there and just add 25 to the First Position. I then just figure out where my next position is, and repeat the same process. This is just ensuring [T] generates the same values in the respective points on the Lines.

Ok, so I have my Sankey calcs prepped, and my fields wrapped in Table Calcs, it is now time to build the Axis.

3. If you could somehow read the my sketch above, you may have notice I already gave a primer on how to create the Y axis. Essentially, I had to break the Line into sections, and implement different calcs at each section.


If you haven't noticed by now, the order of this is backwards (Right to Left). I think of things in a strange order sometimes, so this made sense to me. But if you are doing something similar, you may want to think Left to Right. Starting from the Left, Box Office Rank (1-8), Then my Sankey from the Box Office Rank to the Rotten Tomatoes Rank, the Rotten Tomatoes Rank, then Sankey to Film Rank, then Film Rank....geesh! When you look at it, I am really just thinking in terms of sections and where I want things to happen. The calcs are written in the order the visualization appears.

Now that I have the Y, I need to X. Well lucky for me, the X is just INDEX(). So now let's build the initial view!

4. First thing to do now is create the Bin from 1-398 using the Bin field from early. Simply create the Bin on the measure, and set the size to 1. Then drag that Bin on the Details Shelf of the viz. Next, drag Film onto the Detail shelf, Y on the Y Axis and X onto the X axis. Should look kinda funny at first....


The reason it doesn't look correct is because the Table Calcs are not correct. What we need to do is Compute everything using Film and Bin, and restart it every Film. That way our Indexes and calcs are computed by Film individually and the Bin densifies the data.


Ok now we are talking! Now, I think Right to Left, but we see Left to Right, so let's just quickly Reverse the X axis to make things look right.

Now that we have the general structure, it is time to build on it.

5. Love thy reference lines! So we need to build out separators for 3 sections, 1 to break it up visually, 2 because we need to simulate and Axis for when we plot the Coordinates later. So I just went in and created Ref Lines at the beginning and end of each section, and gave a custom value equal to the beginning and end of each section.


I can start seeing my crazy idea coming to life! Ok so we have the foundation, and the sections defined, but I also want to include titles on each Section to help aid in the analysis. For this, I just created Annotations at each Section. Now we need to add the points. How do we do this? Dual Axis of course, but we have to define our Dual Axis first!

6. In order to get points in the Exact Position on the Chart, I need to do 2 things, 1 normalize the Marks to 100% (Remember the sections are 100 marks) and then ensure that is in the correct index range. 

What I am doing it getting the MAX measure for Box Office (Via LoD) and diving each Box Office by it (100% Range). I would do the same for Rotten Tomatoes, but I know that range is 0-100%. Next thing I do is wrap it in a Table Calc, and subtract is from the Max End of the Section Range. Finally I just tell Tableau to only return the Index when it equals that value. (The calc also includes 398...after the initial build, I had the idea of adding Movie Covers)

Now that it is defined, drop it next to the X, Dual Axis and Synchronize.


Cool, we have the marks in the correct position, now we just need to actually define the shapes.

7. To create the Shapes, I needed to define the Shapes in the Rotten Tomatoes and Worldwide Box Office Sections the same, but different from the Film Covers. Off to another Calc!

Basically all I am doing is defining every mark in each section outside of the Film Covers, then defining each Film as it's own value. I wrap them as strings so I can assign shapes off of it. Now I can set each Film cover, and the other Sections as completely different shapes. 


Looking good, but it has issues. The Circles are too big, and the Film covers are too small. To fix this issue I just created a calc to out on the Size Shelf (Simply INDEX()==398). This allowed me to increase the size of the Film Covers, while shrinking the size of the Circles, creating a much more clean look.



From here, I only have a few steps left (Told you before, really long post!). But I need to get the Labels in there for my Dual Axis. But they need to be formatted differently. What to do? Well they way I did was by creating a calc for each measure, and then stacking them next to each other on the marks card.


Essentially, I am defining the exact position of the Marks (Like I did for the Dual Axis) and then returning the Value. This allows me to format each measure uniquely, and I can NULL out the other marks. This then gives the illusion I wanted on the viz.


Ok, we have to be done right?! Not yet, but soon. I also added Tooltips, and, a conditional URL Action.

8. Conditional URL Action? Ben Jones was giving me some feedback, and said, "It would be great if when you clicked on the Movie Cover, you went to a website about it". Awesome idea! But how to do it? I didn't want every mark to be a URL Action, just the film cover, but it's one sheet...Well I found that URL Actions don't happen if the field you pass in is NULL. So I could create a Calculated Field that only generates the Link on the Film Cover mark, and none of the others.



Now when I setup the Dashboard Action, only the first mark will have a value, so only the Film Cover will open a browser. I also need to tell people that they can do that, so I created another Calc with the same logic that returns "(Click to learn more)" and have it only appear on the film cover.

Now we are onto last minute cleanup! Pretty simple, Show Title (For Title), Show Caption and Write your Footer (Using a Caption like a Footer is a trick I picked up from Adam Crahen), and add Row Borders to separate the Viz from the Title and Footer.

And we are Done! Was the Juice worth the Squeeze? Not too sure, but there was a lot of learnings in doing this. It made me really think about what Tableau can do given a little imagination, math and calcs. There are a lot of features, like annotations, ref lines, etc, that can be used to things they weren't necessarily meant to do. You can generate Shapes, and Marks conditionally by using logic and you can even create sections with different vizzes on a continuous stream. Maybe this isn't a great Data Viz, and there are probably more efficient ways to display the data, but this Viz is Fun. It's fun data, fun to make and learned things. 

If you have made it this far, THANK YOU for reading. I hope there was at least trick/tip you picked up that would be useful. If you have questions/comments, please leave them below!

Rody


BATMAN : The Twist and Turns of the Movie Franchise

Data visualization of the Batman Movie Franchise. Data was collected from Wikipedia and Tableau was used to visualize. I created this viz out of curiosity and boredom. 1. I wanted to make a continuous viz with multiple encoding within a single defined frame, and 2. It looked cool in my head and my pencil sketch.  I added explanations withing each section to help aid the audience in understanding the data.

Explore the interactive below.



The Viz is constructed of 5 Sheets

1. The header is a modified Marimekko designed to look like Boxes. This was done by using MIN(1) on the Rows Shelf, changing the chart type to Bar, and then Fixing the Size and the Axis.


I do this to give a clean look on the edges of the viz a clean look when floating another sheet to it on the Dashboard. Also, since Tableau doesn't "Wrap" text marks on this type of Viz, I used a calculated field REPLACE([Film], ' ', CHAR(10)) to create a line break after each space. Not the best solution, but it gets the job done for situations like this.

2. The next sheet is a Jump Plot (kind of). It was built by setting up an Excel sheet with the Films, the Film Number and the Years between Films.

 

From there, I cross joined the Dataset to an Excel Sheet containing 32 Rows of X/Y Coordinates for a Half Circle. After which I simply added the Film number to X and Multiplied Y by the difference in Years. This is similar to what I did in the Marvel Characters Viz

3/5. Sheets 3 and 5 are Sankey based Slope Charts. These use the same method Chris Love described here but with some slight differences.


I pre-processed the Data to find the Ranks (Film Release, Rotten Tomatoes and Worldwide Box Office) for each end (1-8), and wrapped them in Table Calcs (Simple RUNNING_MIN) to ensure Densification. These were then set to Restart every Film, creating the Sigmoid Curves from One Rank to the Other.

4/6/ Sheets 4 and 6 were Dot plots with a Skinny Dual Axis Bar Chart for effect.



Finally, some cleanup and Dashboard Actions were used to create the Highlight across sheets, giving the illusion of one continuous viz.


Feel free to download the Workbook and explore more. If you have any questions/need me to explain in more detail, feel free to contact me by email or Twitter.

Rody


MARVEL: The Characters of the Cinematic Universe (Jump Plot Alternative)

Data visualization of Character appearances in the Marvel Cinematic Universe. Data was collected via Wikipedia and Tableau was used to create the visualization.

For optimal experience with Visualization, view on Desktop.

Note* This could be more effectively shown by using a Highlight Chart with Films on Columns, Characters on Rows and a Two Tone Pallet to Show movies Characters were in vs not in*
Uses a modified version of "Jump Plot" by Chris DeMartini (This viz is more of an Arc Chart, but follows a similar pattern). Datasource was partitioned to show Film Number and the "Next Film" by character. This was done so the Arc calculations could be done on a single Row. This is similar to an Entrance and Exit Node. They Key here is to Have the Current "Node/Event" and the Next "Node/Event" on the same row, and a Field that has the difference between them, this allows us elongate the Arc Horizontally to "skip" nodes/events if needed. *NOTE: In order for this method to work like a Jump Plot, it is necessary to create a Field that defines the Y Axis, or the Height of the Arc. This could be something like Day/Hours/Etc between events. If a Movie was a characters "Last Film", then the I mark the "Next Film" as the Current. This ensures the Last point does not generate an arc. See Data below as example.


I then created the X/Y coordinates of a Half Circle from 0-1 in a 30 Row Excel sheet. That is then Cross Joined to the Master Data on a fake Column called Joined (All with values of 1). This gives me Concentric Half circles for every record (This multiplies a Dataset by a product of 30).


After this point, I create 2 calculated fields in Tableau for the new X/Y Coordinates. Sample below

[JumpX]

([X]*[Arc Diff]) +[Film Number]

I multiply my X by the [Arc Difference] or the Difference. This is the difference between the Entrance and Exit Nodes, or the Difference between the Current, and Next Points. This elongates the Arc Horizontally to cover the Gap between Nodes. I then add the Current Point, or Entrance Node to that X to "Move" the Arc horizontally to the correct node.

[JumpY]

[Y]*[Arc Diff]

Simply elongates the Arc Vertically for look and appeal of the difference between nodes. *Note* in a normal Jump Plot the Arc Height is usually defined by another factor, such as Days/Hours/Etc between events. You would then multiply [Y] by that field.

After this point, I simply Float another sheet that displays the "Nodes" or "Events" to the bottom to give context to the Arc.

The "Color on Highlight" feature uses the same technique I described here 

For more details, contact me!

Godzilla Film Stats | Excluding the 1998 Travesty

Godzilla Film Stats | Excluding the 1998 Travesty
Visualization on misc stats from the Godzilla Film Franchise (Excluding the horrible 1998 film.....).

Data was collected from various sources. IMDB - Ratings, Noger Chen - Godzilla Height Metrics, Jokercluser.blogspot.com - Percent of On Screen Time and Wikizilla for the images.

Check out the interactive viz below, and discover more.

Having the Best NBA Regular Season Record does not always equal a championship

Having the Best NBA Regular Season Record does not always equal a championship
Using Data from Basketball-reference.com, I looked at how teams ranked according to regular season record and which teams won the championship. When looking at the data, I noticed that only 5 teams since 2000 had the Best Regular Season record, and Won the Championship. In fact, more teams that finished 3rd in the rankings won championships, than teams that finished 1st. Interactive visual below



EAGLES : The Very Best Of (2003) Visualized

EAGLES : The Very Best Of (2003) Visualized
Visualization of the "EAGLES : The Very Best Of (2003)".

Data was collected from Lyrics.Wikia.com via Parsehub.com and Tableau was used to visualize. Outlines how many songs came from which albums, and how many words were used in those songs. Albums are sorted based on Original Release Date, and Songs are sorted by Total Words. Hover over the Albums to highlight Songs, see Song Names, and the number of Words.



QUEEN | Analysis of the Words and Songs of the first 10 legendary albums

QUEEN | Analysis of the Words and Songs of the first 10 legendary albums
Text Analysis of the every song from Queen's first ten albums. Data was collected from AZLyrics.com and Parsehub.com was used to scrape through the various albums and songs to get the lyrics. From there I used Excel and VB Macros to split and reshape the data so there was one word per row. Tableau was used to visualize.




Visualization was created using modified Sigmoid functions, and well positioned floating sheets. Concept was developed after finding the Image of Freddie Mercury online, saw the image of the Rainbow of Songs coming out of his fist, and thought it would make for a cool visual. The added bonus of the Tableau Public Footer made for a nice "Stage" to play into the overall theme of the viz.

The NFL's Longest Field Goals

The NFL's Longest Field Goals
Visualization on the NFL's Longest Field Goals. I collected the data from Wikipedia (https://en.wikipedia.org/wiki/Field_goal) and used Tableau to Visualize. I created the "Field Goal Arcs" by modifying Bezier Curves.

Things to Note*
Sebastian Janikowski | 2 of NFL's Longest Field Goals
(Janikowski was attempted a 78 yard)
Mile High Stadium | 3 of NFL's Longest Field Goals