Sign in or start a free trial to avail of this feature.
4. Plotting Routes in Tableau
Plotting routes on a map can be very beneficial, especially when examining the customer behavior and movement. In this lesson, we learn how to plot the route of a yacht in the Mediterranean.
To explore more Kubicle data literacy subjects, please refer to our full library.
Plotting routes in Tableau
- For this chart, we need geographic coordinates and a column to order these points
- The ordering column can be a date field or a numeric field
- The geographic coordinates are initially added to the map
- The mark needs to be changed to LINE
- To join the lines correctly, we add the ordering column to PATH
- To improve visualization, you may want to include points and lines on the same chart
In addition to plotting points in Tableau, in certain instances, we may want to plot routes. For example, monitoring the routes of customers as they walk through a shopping center or a department store. In this example, I'm going to use data related to the root of a yacht as it travels around the Mediterranean. As I scroll over each data point, I can see the route that the boat takes during July, August, and then into September.
However, to get from the raw data to this final visualization is quite difficult. But in this lesson, we're going to learn how to accomplish this task.
Let's first take a look at the data.
Each line in the data set represents a single location with longitude and latitude coordinates and a timestamp. Unfortunately, there are a few blanks that will cause some issues later on, but we'll worry about this problem once we encounter it on our chart. What we need in Tableau is a feature that can link sequential points together based on the timestamp. And this feature is called path.
Let's now go back to Tableau where I have the data ready to go. I'll start by adding longitude and latitude to the shelves.
And in addition, I'll add time as the level of detail, but I'll make sure to select minute because each individual row in the dataset has this level of granularity. And now I have all the data points from my dataset mapped over Greece and Italy. To bring up the path feature, I need to flip my mark to align.
And now I can select path and now I can drag time onto path.
But again, I'll need to select minute.
Now that I have the lines created on my chart, I'd like to overlay the individual data points on top of the lines. And to do this, I'm going to drag latitude onto the row shelf again.
And this time I'll flip the mark to a circle.
And now I'll simply add to dual axis. There we go. Now our chart is almost complete. To join the remaining lines together, we need to deal with the nulls that we saw in the CSV file. And unfortunately, the nulls are creating breaks between the individual data points. To fix this, we can hit the nulls and select filter data.
And with the nulls now removed, we have the exact route of our boat for July, August and September.
To make this chart a little easier to read, It might be worth adding a filter and also adding a border to this particular data point, which I'll do here.
As you can see, the path feature is extremely useful when you have a series of data points that are separated merely by individual timestamps. The path feature makes sure that this data is ordered correctly, so you get the correct route of a customer as they pass through a particular area of interest.