The line graph, in contrast to its sibling the bar graph, is at its best when used to visualize the shape and/or trend of a series of values. As normally deployed, the horizontal axis (typically designated as the x-axis) is a continuous, usually linear range divided into equal and regular sections. A common and appropriate x-axis is time, so that the line emphasizes the change over time of the value depicted on the vertical axis (typically designated as the y-axis).
Each data point in the series is plotted against the x and y axes, and then the plot points are connected by drawing lines—usually but not always straight lines—between them, moving (typically) left to right across the graph. The lines connecting the plot points for any one series are usually consistent in color and style.
By examining a line graph, even an untrained viewer can easily detect patterns including growth, decline, or cyclic behavior.
Line graphs are particularly well suited to comparison of the trends of two or more data sets over the same x-axis, such as sales of different products over time. This is because the lines do not take up much space in the display area, and so they can cross each other without hiding each other unless they directly overlap because consecutive points in the data sets have identical or near-identical values. By contrast a bar graph is not well suited for comparison because it cannot be overlapped without obscuring one of the data sets.
Line graphs are often square, although they may be rectangular when the available display space necessitates it or when the x-axis is particularly long or short, and it is important to display that set or subset of data.
Line graphs which are wider than they are tall are often used as the primary visualization of stock market data, tracking the change over time of an individual stock price, although in some cases an area chart may be used instead. For stock data, the line graph is typically paired with a bar graph beneath, with a synchronized x-axis, so that the bar graph can show volume data corresponding to the price data on the line graph. The pairing is useful to find areas of heavy trade volume that also have price fluctuations.
Scottish engineer and economist William Playfair popularized the use of graphs, including the line graph, for statistical analysis iin his works including 1786's Commercial and Political Atlas.
NanceMuse points out that it is possible to use a base other than 0 for the Y-axis, which can make patterns more apparent, but can also distort the relevance of those patterns. For example, if a measure of velocity varies between 60 and 75, basing the x-axis line at a Y-value of 50 will make the variations in velocity appear to be larger and more significant than they truly are.
An interesting variation on the line graph is the sparkline (q.v.) which abandons visible axes altogether to purely emphasize trends.
Another variation on the line graph is the ribbon chart in which a 2 1/2D effect is used to give apparent depth to the chart. Most experts1 consider this effect to be chart junk which has no informational value and obscures the data.
Information from several years working on a graphing component, as well as incremental absorption of the works of Stephen Few and Edward R. Tufte, among others.
- For example see Stephen Few's Perceptual Edge design example. Somewhat mortifyingly, I am certain that the chart component depicted is the one that I worked on, and worse yet, it was me who coded the ribbon chart capability. Proud of those ribbons was I, yes, hmmm! Today, perhaps not so much.
Noded from the list of nodeshells on Tem42's home node, and for IN9