Visualization

Interpolation between Data Points

Learn about linear and cubic curves as well as the unique value of Steffen's monotonic cubic method.

What is Interpolation?

Interpolation is a mathematical technique used to estimate values between a set of known data points. It is commonly applied in fields like data visualization, numerical analysis, and physics to create smooth transitions or fill gaps in data.

In data visualization, interpolation determines how lines are drawn between discrete data points in charts, particularly in line charts, area charts, and smooth curves. The choice of interpolation method significantly affects both the visual appearance and the implied meaning of your visualization.

The most straightforward method of interpolation is linear interpolation, where straight-line segments connect adjacent data points. While effective and easy to compute, linear interpolation lacks smoothness, resulting in a "piecewise" appearance that may not align with the natural trend of the data.

To address this, methods like cubic interpolation use polynomials to produce smooth curves. However, these methods can introduce new challenges, such as violating "monotonicity" in the data.

What is Monotonicity?

Monotonicity refers to a series of values that either consistently increase or decrease in value. For example, a cumulative rainfall total is monotonically increasing.

When interpolating between data points, a curve that preserves monotonicity respects the natural direction of the data, maintaining its increasing or decreasing behavior. While cubic methods of interpolation create smooth, pleasing curves, they often violate monotonicity by producing spurious dips or peaks that are not present in the actual data.

Different interpolation methods make different assumptions about the behavior of data between known points, and choosing the right method is crucial for accurately representing your data's underlying patterns.

Linear Interpolation

Linear interpolation connects data points with straight line segments, creating a piecewise linear function where the line between any two points follows the shortest path.

Characteristics:

  • Simple and easy to understand
  • Makes no assumptions about data behavior between points
  • Can create sharp angles at data points
  • Preserves monotonicity (if data increases, line increases)

Best used when:

  • You want to avoid implying relationships that aren't supported by data
  • Data points represent discrete measurements
  • Sharp changes between data points are meaningful
  • Simplicity and clarity are priorities

Cubic Interpolation

Cubic interpolation uses cubic polynomials to create smooth curves between data points. This method considers not just the adjacent points but also the broader context to create smooth, continuous curves.

Characteristics:

  • Creates smooth, visually appealing curves
  • Can sometimes overshoot or create artificial peaks and valleys
  • May not preserve monotonicity
  • Implies continuous, smooth relationships between variables

Best used when:

  • The underlying phenomenon is expected to be smooth
  • You have sufficient data points to support smooth curves
  • The visualization benefits from reduced visual noise
  • Trends and patterns are more important than precise values

The Monotone Cubic Solution

To address these challenges, Matthias Steffen's monotonic cubic interpolation method modifies standard cubic interpolation to preserve monotonicity while maintaining smoothness. Introduced in the paper "A Simple Method for Monotonic Interpolation in One Dimension" (1979), the method ensures:

  • Smoothness: Produces curves with continuous first derivatives, avoiding abrupt transitions.
  • Monotonicity: Prevents spurious oscillations or extrema between data points while ensuring that any peaks or troughs occur only at the actual data points.

This is achieved by constraining the first derivatives (slopes) at each data point to avoid overshoots or reversals in the curve.

Key advantages:

  • Produces smooth curves without artificial overshooting
  • Preserves monotonic relationships in the data
  • Avoids creating false local maxima or minima
  • Maintains the essential character of the data while improving visual appeal

Best used when:

  • Working with monotonic data that should remain monotonic
  • You need smooth curves but want to avoid misleading implications
  • Accuracy of trend representation is critical
  • You're visualizing time series, growth curves, or cumulative data

In Mappica, line and area charts can be constructed using Steffen's interpolation method by selecting the "Monotone Cubic" curve option.

Choosing the Right Method

The choice of interpolation method should align with both your data characteristics and your communication goals:

Use Linear Interpolation when:

  • Data represents discrete, independent measurements
  • You want to avoid implying continuity that doesn't exist
  • Precision at each data point is more important than smooth trends
  • Your audience expects or requires conservative interpretation

Use Cubic Interpolation when:

  • The underlying process is naturally smooth and continuous
  • Visual appeal and trend clarity are priorities
  • You have sufficient data density to support smooth curves
  • Minor overshooting is acceptable for your use case

Use Steffen's Monotonic Cubic when:

  • You need smooth curves but must preserve data characteristics
  • Working with cumulative data, growth rates, or time series
  • Accuracy of trend direction is critical
  • You want the benefits of smoothing without the risks of overshoot

Implementation Considerations

When implementing interpolation in Mappica:

  1. Consider your data type: Financial data might require conservative linear interpolation, while temperature data might benefit from smooth curves
  2. Think about your audience: Technical audiences might expect linear interpolation, while general audiences might find smooth curves more intuitive
  3. Evaluate data density: Sparse data often works better with linear interpolation, while dense data can support smoother methods
  4. Test different methods: Preview your visualization with different interpolation methods to see which best serves your communication goals

Understanding interpolation helps you make informed decisions about how to represent the relationships and trends in your data, ensuring your visualizations are both accurate and effective.