Data Visualization

Introduction to data visualization in tableau

In order to follow the materials in this section and create visualization, load sc-counties.csv file into the Tableau Desktop that represent the filtered data by using Tableau Prep. After successful loading and navigating to the Sheet 1 the Tableau interface is ready for visualization. The first visualization is related to plotting the weekly basis moving averages of various counties in the South Carolina for the number of COVID-19 cases.

In order to plot Cases field which represent the number of COVID-19 cases versus the date in a weekly basis, drag and drop the Date from the tables to the Columns and drag and drop the Cases from measures to the Rows.

Now click on YEAR(Date) and change it to Weekly Number:

This option gives you an ability to slice your data based on date. For example, instead of week, you can choose to slice it by month or quarter. For more customized slices we need to calculation of tables.

What's the temporal trend of COVID-19 cases in a specified time window?

On the other hand, instead of visualizing the summation of COVID-19 cases, we need to visualize their average values on a weekly basis to visualize the moving average. As a result, click on the SUM(Cases) and change it to average.

Different counties in the state of South Carolina are attributes that are stored in County field. Drag and drop the County from Tables to the Marks.

Now change the County to color.

Now, you should be able to see the visualization of moving averages of different counties based on different colors.

It is possible to filter the data by choosing some of the counties that you want to create visualization specifically. For example, in this section we choose the Pickens and Greenville counties from the right side toolbar.

You should see the filtered visualization as.

How to combine various charts in a single view

Adding multiple measures in a single view is pretty easy and seamless in Tableau Desktop. You need to drag and drop another measure, which would be the number of deaths of COVID-19 in the state of South Carolina at the county level to the Rows and change the SUM to AVG similar to what we did in the previous section to visualize the weekly basis moving averages of the number of cases and deaths in a single view.

What's the fatality rate (deaths per cases) of COVID-19 cases across South Carolina? (Table Calculations)

Using table calculations and creating new fields helps to explore and understand more critical points about the data. One important thing about the COVID-19 dataset particularly is that, what's the fatality ratio and how it is changed over time. Of course comparing the number of cases and deaths in the previous section might give a qualitative measure to understand that, but in order to visualize it quantitatively, table calculations would help us here. As a result, let's define a new measure by creating calculated field. In order to create a calculated field, right click on the Measure toolbar and choose Create Calculated Field.

Define a new field and name it DeathsToCases.

Now, let's add the newly defined DeathsToCases to the Rows and visualize its weekly basis moving average.

By visualizing the DeathsToCases we see that the fraction of deaths because of COVID-19 started from zero to around 4.5% for Greenville county and 2.5% for Pickens county at its peak fatality around beginning of the May but right now it is decreased to around 2% for Greenville county and 1.5% for Pickens county.

Ways of extracting the trendlines

Highlighting data with reference lines helps to understand the trend of the data that is visualized here and have a more efficient communication with the user. In order to add reference lines, which are calculated automatically by Tableau Desktop based on linear regression, go to Analysis --> Trend Lines --> Show All Trend Lines.

Now the trend lines should be added to the final visualization:

In order to see the quantitative data of the fitted lines by Tableau Desktop, go to Analysis --> Trend Lines --> Describe Trend Models.

This trend lines model describe the R-squared as well as other parameters for linear regression for each plot in the view.

Merging multiple datasets

In order to add another dataset into the Tableau Desktop and merge it with the current one, another file named ga-counties.csv which represent the COVID-19 in the state of Georgia is dragged and dropped to connect to the current South Carolina dataset (sc-counties.csv).

Now, click on the red error sign at the middle of two files in order to match fields in these two datasets and merge them together.

As a result, we see that these two datasets are merged together.

Now, we could visualize these two datasets together.