It will be more difficult to see details in these plots, so it’s a good idea to sort them by some important characteristic (like average or final value) to help draw out important points. If you find the need to plot more lines than can be read in a single axis, then you might consider faceting the plots into a grid of smaller line charts. However, if the lines are well-separated, you can still plot all of the values you wish to track. A good rule of thumb is to limit yourself to five or fewer lines, lest the plot end up looking like an unreadable tangle. With great power comes great responsibility, so while there is the technical capacity to put many lines onto a single line chart, it is a good idea to be judicious in the amount of data that you plot. It can also be possible to use multiple lines, with one line for a fine-grained interval, and then a second line for the overall trend, averaging over a rolling window. Testing out different intervals or relying on your domain knowledge about what data is being recorded can inform you of a good choice of bin size. On the flip side of the coin, a too-short a measurement interval may only reveal noise rather than signal.
For temporal data, a too-broad of a measurement interval may mean that it takes too long to see where the data trend is leading, hiding away the useful signal. Dateīest practices for using a line chart Choose an appropriate measurement intervalĪn important aspect of creating a line chart is selecting the right interval or bin size. In these cases, the columns specify the horizontal values, vertical values, and to which line to each row will be assigned.
Each following column indicates the vertical position for points of a single line.Ĭertain tools create line charts from a different data format where three columns are expected regardless of how many lines to plot. Values in the first column indicate positions for points on the horizontal axis for each line to be plotted. To use a line chart, data often needs to be aggregated into a table with two or more columns. This line chart shows there are many more subscriber trips than guests, but guests tend to take longer trips on average. Line charts used to depict frequency distributions are often called frequency polygons. However, since it’s tricky to plot two histograms on the same set of axes, the line chart serves as a good mode of comparison as a substitute. Normally, we would use a histogram to depict the frequency distribution of a single numeric variable. The ability to plot multiple lines also provides the line chart a special use case where it might not usually be selected. A common use case for this is to observe the breakdown of the data across different subgroups. Multiple lines can also be plotted in a single line chart to compare the trend between series. Often, this will be a statistical summary like a total or average value across events within each bin. On the vertical axis, you will report the value of a second numeric variable for points that fall in each of the intervals defined by the horizontal-axis variable. The choice of interval size, or bin, is a decision that the analyst will usually need to make for the data, rather than it being an inherent data characteristic. Very commonly, this variable is a temporal one, generating an observation every minute, hour, day, week, or month. On the horizontal axis, you need a variable that depicts continuous values that have a regular interval of measurement. This emphasis on patterns of change is sold by line segments moving consistently from left to right and observing the slopes of the lines moving up or down. You will use a line chart when you want to emphasize changes in values for one variable (plotted on the vertical axis) for continuous values of a second variable (plotted on the horizontal). We can read from the general slope of the line and its vertical positions that the rate improved from about 0.75 to 0.78 between March and early April, then fell gradually to about 0.765 in late May and June. As time progresses from left to right, points connect the daily exchange rates.
The line chart above shows the exchange rate between two fictional currencies over a six month period. The horizontal axis depicts a continuous progression, often that of time, while the vertical axis reports values for a metric of interest across that progression. A line chart (aka line plot, line graph) uses points connected by line segments from left to right to demonstrate changes in value.