This visualization shows that on average, percentage of obesity is inversely correlated with the percentage of population having a bachelor degree or higher. Each line represents a U.S. state. The left axis represents the obesity percentages, the right axis represents the percentages of people with a higher education. Original visualization created by Alberto Cairo.

First, we draw a line, repeat it by “State”, then set the resulting collection’s layout to “none”. We then select the first vertex of every line, and bind its y position to “Obesity Percentage”; similarly, we bind the y position of the second vertex to “BA Degree Percentage”. Since we want these two encodings to share the same scale, we choose the option “Merge with Obesity Percentage” when binding to “BA Degree Percentage”.

Next, let’s style the lines. We select the vertices, set their shapes to circle with a radius of 4 pixels. We then select the lines, bind their stroke color to the categorical field “Obesity vs. Higher Education”. The default color scale is not what we want exactly, so we can customize the colors for the two categories. Let’s also thicken the stroke width and change the opacity of the lines.

Finally, let’s drag the axis handle to increase the range extent. Since the scales are merged, dragging one axis handle also affects the other. We can flip the orientation of the y axis for “BA Degree Percentage” to the right, so that the two axes look more symmetrical.