Lines #
last modified February 24, 2026
~9 minute read
Establishing Contrast in Lines #
It is frequently the case that data visualizations incorporate several distinct mathematical lines. This is inherently true when a line plot tracks multiple separate data series. However, it is also fundamentally applicable whenever a data visualization explicitly displays $x$ and $y$ coordinate axes.
Whenever multiple lines inhabit the same graphical space, you must proactively determine which elements should appear visually linked and which must stand apart. In essence, you are navigating the foundational design principles of consistency and contrast. Understanding how to artificially construct contrast between lines—the mechanics of making them visually distinct—is the central focus of this article.
We will examine three distinct visual properties: thickness, pattern, and color. Without deliberate variation across at least one of these properties, lines on a plot remain indistinguishable.
In the example above, there is zero contrast even between the lines representing quantitative data and the infrastructural lines defining the axes. To a discriminating eye, this creates a deeply ambiguous graphic; it is unclear what specific information the reader is supposed to elevate. Modern visualization tools therefore routinely render data lines thicker than structural axes lines by default, leading directly to our first method for generating contrast.
Thickness #
For the above plot, if we make the data lines double the thickness of the axes lines, we have a plot that, to my eye, makes it much more clear where the focus is.
But this still doesn’t really help distinguish the data lines. Interestingly, we really don’t need to make “income” appear different. Since this line never crosses another, we can clearly assign the label to a single line. But for the housing and education costs, the story is different. We might imagine that education costs are increasing steadily, but we don’t actually know which one of these costs has the dip around 2011. We can distinguish between them by increasing the thickness of one of the lines.
Now, it is unambiguously clear that the education costs are rising steadily on an isolated trajectory.
Some designers might argue that altering the thickness of only a single line is an unbalanced approach, and this is a valid critique. Elevating only one line’s thickness inherently assigns it a heavier visual weight, subtly emphasizing it over the surrounding data. If the goal is parity, altering the thickness of every distinct line diffuses this unintended emphasis.
Note that, when adding in a new thickness, I preserved the largest difference in thickness for those lines that cross, helping creating more contrast at the point where it is most needed.
While distributing three different thicknesses helps mitigate the unintended hyper-focus on education costs, it does not fully eradicate the bias. This is an unavoidable facet of human psychology: we unconsciously identify larger, heavier items and instinctively assign them greater narrative importance. If your explicit goal is to direct attention, manipulating thickness is a superb technique. However, if your goal is strict differentiation without hierarchical emphasis, you must look toward line patterns.
Pattern #
When thinking about line patterns, they are typically given names like “dot” or “dash” or “solid”. We can show a plot with all three present.
Now we can again tell these three lines apart. We do have a small problem in the fact that the dotted line has less visual weight than the others, and so may be de-emphasized some. But it is perhaps a bit less strong than when using widths.
There are a few things to keep in mind when using patterns. First, is to remember that contrast in patterns comes from the difference in the length of the ink and the length of the white space. Thus, controlling the differences in these elements will allow you to control the degree of contrast you have. Consider the following plot:
Now the two crossing lines both have dashed patterns, though they are slightly different. The contrast is still good enough that we can tell them apart, but not as strong as they were above.
Second, it is crucial to recognize that standard software implementations of dots and dashes inherently introduce negative, empty space into the data series. The more white space you inject into a pattern, the higher the risk of obscuring critical high-frequency fluctuations within the dataset. Consider the consequence of simply swapping the dominant dash patterns from the previous example: #
We have now added the pattern with the most missing space to the data with the most variability in the values. This has the effect of “smoothing” out the data, as we are missing many of the changes. Compare this to the plot above, or the plots where this is a solid line. Thus, if you turn to patterns, it is extremely important to understand that you might be obscuring features of your data.
Of course, there is a way to try to remedy this. You might consider not simply using missing ink, but using ink of a different value. Perhaps a light grey. This will return the features, though they will still be a bit harder to see:
Of course, adding back in ink also reduces the contrast within the pattern, and so reduces the effectiveness. Thus, it might be worth considering even other ways to realize contrast in lines, which leads us to consideration of color.
Color #
As examined extensively in the module covering data markers, we can generate contrast by manipulating the three core pillars of color theory: hue, saturation, and value.
Saturation #
Probably the weakest channel for contrast is saturation. Here is an example of the plot, where the saturation varies by steps of 25% between lines.
The lines are arranged such that the two lines that cross differ by the largest amount, 50%, but it is still relatively hard to tell the two apart.
Value #
We can attain more contrast by altering the value of the color. Below is a plot where the value changes by increments of 25%. Again, the largest difference (50%) is between the lines that cross.
It is clear that greater contrast is achieved when using value, as compared to using saturation. Thus, this is not a bad choice for distinguishing between lines—especially if you are wishing to use a monochrome palette or you want to try to encode a quantitative variable to the colors.
Hue #
Even though the contrast is fairly good between the lines that differ in terms of value, you can usually attain even better contrast when changing hue. Below is the same data, but now there is no difference in saturation or value, but there is in hue.
To my eye, these are the simplest to tell apart. Also, it is worth noting that the two lines that cross are not even as far apart as they could be in hue space, but were chosen to be a split complementary color, to emphasize the connection between the two categories associated with cost, while accentuating the difference from income.
Of course, when relying on hue, one should be careful to ensure that the colors chosen are accessible (e.g., they are colorblind friendly), but as long as you do so, the changes in hue are an excellent way to encode categorical differences.
Degree of contrast depends on size #
As a universal design principle, the perceptible degree of contrast achieved through any parameter manipulation is inextricably linked to the physical size of the graphical element. Consider the strong contrast previously achieved through hue variations. If those identically colored lines are rendered artificially thin, the following result occurs:
In this image, looking at only the lines, it would be quite hard to tell the difference between the lines that cross. However, the hue has not changed—just the thickness of the lines.
Other lines #
It is worth recalling that there are many other types of lines than data lines. Lines of the axes and gridlines are just two such examples. All of what was discussed above are ways to also alter the contrast between these elements and all other lines within the visualization. This could be used, for instance, to de-emphasize contrast of the axes. Below, the lines associated with the axes has been changed to light grey, which makes them fade more into the background, and puts emphasis even more on the data lines.
For consistency, one might also change the tick marks and tick labels and axes titles to be the same light grey, but since we are discussing only lines here, we have changed only them. The point is that one can consider all the lines in the plot, and make choices regarding their appearance to place focus where you want it.
Key takeaways #
The general guidelines for designing lines is the same as for any other element of a graphic. You want to consider where you want to direct attention and what connection you want the viewer to see between the line on the page. Then you choose the parameters in order to differentiate between lines, or have them look similar, all in service of communication. Bringing this all together, imagine we wanted to draw the connection between the categories that are expenses, and then wanted to emphasize the income line. One way to do this is to keep the color palette above, and then make the income line thicker, like shown below:
Thus, you can see that the ideas outlined above can be combined in service of the story you are telling.
page last modified February 24, 2026