2. Worksheets

Let's start our analysis with the Immigrant table. On the top left corner of Tableau, click on the drop-down arrow to select the Immigrant_orphans table. An alternative to this step is to drag the table into the table box at the top.

Notice states are also ordered in alphabetical order. To change that, hover over the Y Axis (Median Household Income 2011) and click the bar icon on top of it to change the graphics to descending order, as it is shown in the picture on the right.

Once you have imported your data, go to the bottom left corner and click on Sheet 1 to start visualizing it. As you can see, all of the columns of your table are divided in two panes on the left hand-side: Dimensions (discrete data) and Measures (continuous data).

2.1 Does party affiliation relates to income?

Drag the dimension State to the Columns section on the top of your screen and the measure Median Household Income to the Rows section. Notice the new graphic. It is a bar chart where each column is a different State and the length of the columns is the income value.

We want to answer the question: do states that voted republican tend to have a higher median income or is it democratic states?

To do this, add Vote 2012 to the columns mark. Notice how it lists every state with every option.

Move Vote 2012 in front of State. Notice the difference?

Now the dataset is first divided by vote, and then each vote option (D or R) gets divided by the states in each group.

From the dimensions box, drag Vote 2012 to the Color Mark. Click on Color - Edit Colors. Make sure D is blue and R is red. This helps understand the data a little bit better, but still it is not entirely clear.

Now we can see more clearly the distribution of values for each group. However we can further study this by creating a better graphic for the data: a box and whisker plot. Click the Show Me card on the top right corner, and select box-and-whisker plot.

In a box plot, you will see a box, a line inside the box, some whiskers, and sometimes some dots outside the box for the whiskers. The line in the box represents the median value of the group. The box shows the values half-way between the median and either the minimum and the maximum value in the data set.

Rename your worksheet by double-clicking it's name as Vote Vs. Income.

Go to File - Save and save your workbook as Politics and Immigration by Your name.

2.2 The Tableau Interface

Now that we are more familiar with the program, let's talk a little bit more in depth about Tableau's interface. The Data window on the left has all of the columns of your spreadsheet broken up by Dimensions and Measures.

Dimensions are categorical fields, in other words, the fields that we want to slice our numerical data by. Dimensions are often discrete, like State. They create labels in the charts and are color-coded blue in the data pin and in the view (columns and rows).

Measures are metrics. They are the numbers we want to analyze and often are continuous. They create the numeric axis in the chart and are color-coded green.

2.3 Do states have more permanent immigrants in 2012 or 2013?

Next to your Vote Vs. Income sheet tab, click on the New worksheet icon to open up a new worksheet. Rename it as Immigration 2012-13

Bring the State dimension to columns and Perm Res 2013 to rows.

Change the order by sort descending.

Add Perm Res 2012 to rows. Notice that now you have two graphics. However, it is very difficult to compare one with the other. Click the back button to just work with 2013 data or remove the field out of the Marks card.

Filtering your data

For this exercise, we only want to work with the top states that have accepted the largest number of permanent residents in the year 2013.

To do this, add Perm Res 2013 to the Filters card. In the Filter Field window, leave # All values and click Next.

In the Filter window, select Range of values and change the minimum to 25,000. Notice only 9 states appear in the chart.

Click the Show Me card. This is a very useful card that guides you in the type of chart that you should use based on the nature of your data. If you click on any field on your Data card, you will notice how the charts available change when you select different fields.

As you can see, box plots do not make prettier, simple pictures to show other people, but they are very useful in summarizing the raw data values within a group for yourself as a researcher so you can have a feeling for the raw data.

Remove the Vote 2012 column by hovering over it on the graphic view and selecting Hide field labels for columns.

In the General tab, change the range from Automatic to Fixed and enter 30,000 as the fixed start. Click OK.

Editing the vertical axisWe would like our income levels to start at 30,000K. To do this, click on the vertical axis (Median HouseHold Income 2011), right-click and select Edit axis...

To make your visualization even more clear, drag Vote 2012 to the Color mark. What are some clear observations we can make from this graphic?

If you were to take all the values in your data set and rank them so that the minimum value goes first and the maximum value goes last, you could break the ranked data into four equal groups. The three points that divide the data set into four equal groups are called quartiles. The smallest value of those three is called the first quartile. And the largest value of those three is called the third quartile. The whiskers on a box plot usually extend to 1.5 times the interquartile range. Any data points outside of these whiskers are generally considered outliers.

Let's add a calculation that computes the difference in value between both years. In the Measures card, right-click on an empty area at the bottom and select Create calculated field. In the window that appears, name the calculation PermRes 2013-2012. Drag Perm Res 2013 from the Measures card, add the minus sign, and drag Perm Res 2012 so your window looks like this:

Change the colors in Measure Names by clicking in one of the years. Change your color palette to Color Blind and select orange for 2012 and red for 2013. Your graphic should look similar to the one on the left.

You can add a label by dragging the fields Perm Res 2012 and Perm Res 2013 to the Label mark. Remove them by dragging them out of the Marks card.

To remove the word State, right-click on it, and select hide field labels for roads.

To change the word value, right-click on it, select Edit Axis and change the Title to: Permanent citizens accepted. Click OK.

Add Perm Res 2012 to the Rows card. Notice the two graphics. In the Show Me card, select side-by-side bars.

Now you have two values for each state, one for 2012 and one for 2013. Do you notice any trends?

In the top bar menu, click the Swap button so we get horizontal bars.

To remove the repeated header of Perm Res 2012 and 2013 for every state, click on one of them in your chart, right-click and uncheck Show Header.

Click Apply. Notice you have a new Measure that has the =# sign. This means it is a calculated field. Bring it to the Measure Values card so you can see how your graphic would look with a new value dimension. Remove it from your chart.

Click the Tooltip mark and remove State and the other two fields, leaving only Measure Values.

2.4 Which states accept more permanent residents?

Start a new worksheet and name it Citizens by State. In this case, we want to explore another dimension of the permanent residents in 2013 per state. Drag the State field to Columns and the Perm Res 2013 to rows. Take a moment to think what type of chart will be useful to represent the data.

In the Show Me card, select the pie chart. What are your thoughts?

In the Show Me card again, select treemaps.

Notice that each box represents each State and the size of the box is proportionate to the number of permanent residents allowed in that state in 2013.

Select Packed bubbles just to see the difference. Go back one level to return to the tree view or select it directly from the Show Me card.

Naturally California, New York, Florida and Texas stand out. But is this really a representative picture? What if we want to compare the number of lawful permanent residents with the total population of that state?

For this we create a new field calculation. In the Measures card, right-click and select Create Calculated Field. Call it Perm Res Dens 2013.

Below drag the field Perm Res 2013 and divide it by the TotalPopulation 2011 field.

Click OK. Notice there is a new field in your Measures card. The symbol =# means is a calculated field.

Clean your sheet by clicking the Clear Sheet button on the top menu. Repeat the same process as before, but instead use Perm Res Dens 2013. Notice the difference? Discuss your results with the person sitting next to you.