The visualization example in sports

Let's consider a different example here to illustrate the various different approaches to visualizing data. Instead of choosing a computational problem, we will restrict ourselves to a simple set of data, and show how many different analyses can be done that ultimately result in visualizations, to help in clarifying these analyses.

There are several major league sports in North American sports, and we will compare four of them: The National Football League (NFL), Major League Baseball (MLB), National Basketball Association (NBA), and National Hockey League. NFL has a combined team value of 9.13 billion dollars and a total revenue of 9.58 billion dollars. We will select this sport with the following data of team values and their championships (only part of the data is shown here):

The visualization example in sports

The team value is one significant factor in comparing different teams, but championships also have a value. A simple plot of this data with years completed along the x axis, the number of championships along the y axis, and the bubble size representing the number of championship per year average would give us something similar to the following image:

The visualization example in sports

However, unless you can make it interactive by displaying the labels or details, the preceding plot may not be very useful. The preceding plot is possible with matplotlib, as shown in the following code:

import matplotlib.pyplot as plt
fig = plt.figure(figsize=(15,10), facecolor='w')

def plotCircle(x,y,radius,color, alphaval):
  circle = plt.Circle((x, y), radius=radius, fc=color,
   alpha=alphaval)
  fig.gca().add_patch(circle)
  nofcircle = plt.Circle((x, y), radius=radius, ec=color, 
   fill=False)
  fig.gca().add_patch(nofcircle)

x = [55,83,90,13,55,82,96,55,69,19,55,95,62,96,82,30,22,39, 
  54,50,69,56,58,55,55,47,55,20,86,78,56]
y = [5,3,4,0,1,0,1,3,5,2,2,0,2,4,6,0,0,1,0,0,0,0,1,1,0,0,3,0, 
  0,1,0]
r = [23,17,15,13,13,12,12,11,11,10,10,10,10,10,9,9,9,8,8,8,8, 
    8,8,8,7,7,7,7,6,6,6]
for i in range(0,len(x)):
  plotCircle(x[i],y[i],r[i],'b', 0.1)


plt.axis('scaled')
plt.show()

You can even use this numeric data to convert into a format that JavaScript can understand (JSON format) so that when integrated with an SVG map, it is possible to display the valuation on the map, as shown in the following screenshot:

The visualization example in sports

The preceding map with bubbles would be better if there were associated labels displayed. However, due to the lack of space in certain regions of the map, it would make much more sense to add an interactive implementation to this map and have the information displayed via navigation.

You can refer to the original data source at http://tinyurl.com/oyxk72r.

An alternate source is available at http://www.knapdata.com/python/nfl_franch.html.

There are several other visualization methods you could apply, apart from the plain bubble chart and the bubble chart on maps. One of the visual formats that will look cluttered when displaying the statistics of 32 teams would be a pie chart or a bar chart.

It not only looks cluttered, the labels are hardly readable. The whole point in showing this pie chart is to illustrate that in this sort of data, one has to seek alternate methods of visualization, as shown in the following image:

The visualization example in sports

If we combine a set of teams within a certain range of their team value, then by reducing them, we may be able to show them in a more organized fashion, as shown in the following image:

The visualization example in sports

The preceding image is one alternative to display the value of teams by segregating them into groups, for example, denote 2300 million dollars for $2300,000,000, which means 2300 million dollars. This way, the data labels are readable.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset