Hilbert Stocks

Ten years of daily stock prices compressed into Hilbert curves.

Hilbert curves can be used to compress a 1D dataset into a 2D chart. This is particularly useful for very large datasets. In this demonstration, ten years of daily stock prices are plotted along hilbert curves. Data close together in time will appear close together in 2D-space.

The charts below show the similarity between various companies' stock price trends over the past 10 years. Prices are normalised for each company i.e. the trends are more important than the prices. Blue indicates low and orange indicates high, on a logarithmic scale.

The curves are in reverse chronological order, so the most recent prices are at the top left.

Pros and Cons

The advantage of using a Hilbert curve is that the data density is very high. The charts above show the data for every single day over 10 years, so that's roughly 2,600 data points.

On the other hand, the Hilbert curve makes it difficult to see the actual chronological location of a particular datum. It's possible to see roughly where in the ten years a point is by looking at the four quadrants, but only if you are already acquainted with Hilbert curves and know which directions they take.

Horizon Charts

Mike Bostock suggested using horizon charts to achieve a higher data density than normal line charts while retaining the chronological scale.


Hilbert curves provide impressive data density and are good at preserving the locality of the original one-dimensional dataset.

However, it becomes almost impossible to discern the precise location of a particular point relative to the original one-dimensional scale, so "high-density" alternatives such as Horizon Charts may be better if that's important.

Either way, I'm sure Edward Tufte would be impressed by the data density achieved here!

Further Reading

Full credit goes to Jeff Heard for coming up with this in the first place!

Stock price data from Yahoo! Finance.