Online tableau training, tableau tips, & video tutorials

Chart Types

Memberships

3 Ways to Make Lovely Line Graphs in Tableau

Preview

Instructor

Ryan Sleeper

Cementing line graphs as a top choice for your Tableau data visualizations by making them more engaging

This video shares three ideas for making your Tableau line graphs more engaging including formatting tips and two ways to use a dual-axis.

Hi, this is Ryan with Playfair Data TV, and in this video I’m going to show you several ways to make line graphs more engaging in Tableau. Line graphs are one of my favorite chart types. After all, they were invented by our company’s namesake, William Playfair, in the year 1786.

But perhaps it’s because they’ve been around so long I find that people have kind of fallen out of love with this chart type, but it’s still my go-to for visualizing time. It’s going to be the first chart that I start with. Not to say it’s the only chart that I use to visualize time, but it’s always my starting point. So I’m going to show you some ways to make this a little bit better in hopes that it makes your chart type more engaging and people want to use this traditional chart type that really has withstood the test of time.

Let’s take a look at some defaults in Tableau. You can use this with any measures and dimensions, but this chart happens to be looking at Profit Ratio by continuous month of Order Date for one year in the Sample Superstore dataset, and those four lines are colored by Region.

One issue with this default chart is we’ve got some spaghetti-ing going on. Some people referred to this as a ‘spaghetti chart’ because it looks like a bunch of noodles just thrown onto a view. The first thing that I’m going to– my first tip for you is to leverage some of the formatting options available to you in Tableau to help with some of that spaghetti-ing.

So the first thing is– let’s say I cared mostly about the South region. One way to get around some of that noise in the middle of the year is to click on the dimension member that I care about, and as long as this highlighter icon is selected, it will actually highlight that one dimension member. It emerges to the front. The context is still there in the background. But I’m able to see the dimension member that I care about much more clearly.

I have another trick that allows you to permanently set that highlight. All you have to do is edit the colors of those four regions by either clicking on the Color Marks Card or double-clicking on any of the colors, and it will open up this same palette where I can remap the colors.

I could leave the South dimension member as is, that nice bright red, but I could navigate to the Seattle Grays palette and assign everything else a gray color. Let’s go in order here. Actually, I’ll make Central the slightly lighter gray. And click OK.

And essentially, that just set a permanent highlight on the view. Again, I can see how the rest of the business is performing. I can see the context, but the focus is the dimension member that I care about.

It might be hard to see, but if you look closely, the Central and East lines are laying on top of the red line. So we’re seeing a lot of gray and red criss-cross. Those colors actually go in the order of the color legend. So in order to always have the red line stand out on top, all you have to do is click on it from within the color legend and drag it to the top of the color legend. And now you can see that the red line is always on top of the gray lines.

One more thing on the formatting options available to us– these lines, by default, are a little bit skinny. Their weight is a little bit light relative to how large this view is. So you may want to go to the Size Marks Card and bump this up a little bit. If you don’t really have a strong preference, these tick marks are usually pretty good places to aim for, and Tableau even kind of snaps to those. So if I start to scroll to the right, it snaps to that. I’ll call that good for now. Of course, this will be a case-by-case basis.

And then one last thing people are usually a big fan of– there is an effect that lives on the Color Marks Card called Markers. So if I click on the Color Marks Card, under Effects, there’s one called Markers. And if you choose the option in the middle, you will see a marker or a little circle appear where each data point is.

That’s not only aesthetics, aesthetically pleasing– it makes it look a little bit nicer– but it also serves a practical purpose of showing us where there is a data point. For example, there’s a steep drop from here to here in the South region, and without those markers, I can’t tell whether or not there was a data point or a month in between.

So those are the formatting options. My second tip for you is to maximize the data-ink ratio. The data-ink ratio is a coined termed by Edward Tufte in his 1983 book The Visual Display of Quantitative Information. In that book, he coined a couple of terms we still use today, but I have found that over time a lot of my design tips are related to this single concept of the data-ink ratio.

One of the components of the data-ink ratio is that you can have redundant data ink. So yes, the ink on the view is related to data, but it’s repetitive and unnecessary. And if you can clean that up, you’re not going to lose any understanding of the chart, but your chart will be much more minimalist, more engaging, easier to understand.

There’s two opportunities, in my opinion, to improve the data-ink ratio in this view. The first is the y-axis. I’ve got a fairly narrow range– well, I should say a fairly large range, from negative 30% to 35%. But I’ve got a tick mark at every single 5% on the view. In my mind, that’s a little bit repetitive. You can clean that up and fix those tick marks by right-clicking on the axis and clicking Edit Axis. And there is a tab for Tick Marks.

And if you choose this Fixed radio button, you can change their intervals. So by default, they started out at every 5%. If this were 0.1, they’d show up every 10%. And that’s already an improvement. Again, this is a case-by-case basis, so you’re going to want to test this out and find the right intervals for what works for you. But I’ll leave that at 10%. And we’ve already kind of nicely cleaned this up a little bit, that y-axis.

Slightly less popular opinion, but I believe you should be doing that on the x-axis as well. And any time the field, or the pill, on the Columns Shelf or Rows Shelf is green or continuous, you can do those fixed intervals. So even if the dimension is Date, if it is green, I can right-click on the axis and click Edit Axis.

And typically what I like to do with the x-axis is go to the Tick Marks tab and only display the full axis range. So we’ll go from having a tick mark every single month, which in my mind is, again, repetitive data ink, to having one tick mark at the beginning of the year, a second tick mark at the end of the year. So I’ll make this fixed.

My origin could be the first of the year– so January 1st, 2019. But I will bump this up to showing only every 11 months. And you can see that updating in the background there. It starts at January because I set the tick origin to be January 1st, and then it goes 11 months later, all the way to December, before it shows me the second tick mark.

Once again, this is a case-by-case basis. I will admit, one pitfall of this approach is you need to keep in mind that both the y-axis and x-axis are truly fixed now. The reason that’s of concern on the y-axis is if our scale changes dramatically– let’s say all of a sudden we’re only looking at a range of 0% to 10%.

Well, we wouldn’t even see the first tick mark at all. It would just say 0% because that first tick mark’s not going to show up until it hits 10%. Another concern on the x-axis– if my time frame changes and we no longer have the first of the year, for example, we’re not even going to see a tick mark.

But I do think that this is much cleaner. This would work particularly well if we’re looking at this chart in a vacuum. So if I’m doing some kind of year-end report, I do prefer to clean it up in this manner, just showing the full range that we’re looking at.

One last thing that’s bugging me on that x-axis that we can also change– I’ve never liked this label, this default axis title when we’re using continuous dates. It is practical. Tableau is trying to help us out. It’s showing us the name of the dimension, the date part, and the year that we’re looking at. But in my opinion, I’m always providing that information in the surrounding context, and it seems kind of clunky there, especially now that we’ve separated the x-axis and we’re only showing the first month and the last month.

So to clean that up, right-click on the axis, click Edit Axis, and it’s this box that you’re looking for, Title. There’s the default title. If I just clear out everything that is there, you’ll see that default title go away, and we’re left with a nice clean line graph.

Here’s what we started with. It remembered the changes that I made, so those colors are there. But look how much more nicer this is. We’ve cleaned up the y-axis, the x-axis, and we’ve brought attention to the dimension member that we care about.

I do have one last tip for you, which is to leverage the dual axis. We’re going to do this for a couple of reasons. The first way I’m going to show you how to leverage the second axis is to format the markers. Those little circles that I showed you in the first tip, those are very practical, they look a little bit nicer, but the drawback is what you see is what you get. There’s almost no formatting capability. We can’t make those bigger, smaller, et cetera. That’s what I’m going to show you how to do.

If you’re not using the second axis for any other purpose, you can start this technique by duplicating the pill on the Rows Shelf. This is an application of my favorite shortcut in Tableau, which is to hold the Control key while you click on a pill and drag it right next to itself.

If I held down the Control key, what that does is it creates a copy of that pill. What’s important about having two pills on the Rows Shelf is they each get their own Marks Shelf, which can be edited independently from the other. So the first Marks Shelf controls all the marks on the view. The second Marks Shelf controls the marks on the first row. The third Marks Shelf controls all the marks on the second row.

For the second row only, I will change the drop-down to change the mark type from Automatic to Circle. So we have a line graph on top, dot plot on the bottom. I will now convert this into a dual-axis combination chart by clicking on the second pill and clicking Dual Axis.

And because these axes should be on the same scale, I’m going to make sure they are in sync by right-clicking on either one and clicking Synchronize Axis. And essentially, that right axis, because these Marks Shelves are still independent from one another, that second– that final Marks Shelf became, essentially, the formatting for my markers. I can click on the Size Marks Card, drag this to the (right), make those circles bigger. Drag this to the left, make those circles smaller.

And I essentially have just unlocked unlimited formatting flexibility for my markers. I could change the shapes. I could show an up triangle for a positive change, down triangle for a negative change. I could also have a corresponding color– blue for positive, orange for negative. And I’ve unlocked all that flexibility by just making this a dual-axis combination chart.

One more alternative option for you to consider– this last one I prefer only to do if I’ve got one dimension member. So for now, I’m going to pretend that this view is filtered down to just the dimension member that I care about, South. And it’s really easy to get to this last look from this point because all I have to do is change the mark type of the second axis from Circle to Area.

This is a technique I picked up from Google Analytics. Whenever they’re showing a dimension member, only one dimension member at a time, they show a dual-axis combination chart like this with a line on one side and an area on the other.

Once I’m this far, what I typically do is click on the Color Marks Card and drag this opacity slider pretty far to the left, somewhere, like, 15% to 20%. I’ll go with 16%. That seems to be where my mouse wants to go.

But just an alternative look– I think it looks nice. And we’ve still got the practicality of the line graph on the left. That’s the red line that’s kind of standing out on the view. We still have the markers intact to show us where there’s a data point. And then the right axis, in this case, is purely being used to just give us that background shading. It’s a dual-axis line graph and area chart.

Because these axes are showing the exact same values, we no longer need the one on the right. So to finalize the view, I will right-click on the axis and deselect Show Header. And there were several ways to make your line graphs more engaging in Tableau.

This has been Ryan with Playfair Data TV – thanks for watching!