Fitting many timeseries in the same area and formatting them for quick comparison is challenging and an important problem. For example, say that you want to pick stocks in the S&P 500 that perform similarly or which respond similarly to certain numerical transformations (say they have the same trend lines or the same noise frequency). Line graphs are inappropriate for this because they’re too visually noisy and because you can only compare easily up to down, not left to right, visually, limiting the number of graphs on the page at the same time.
For certain comparisons, we aren’t interested in the individual values of a timeseries nor its trend along time so much as we are how it relates to other timeseries in the same dataset. For this purpose over the weekend, I created these:
These are timeseries simply plotted along a Hilbert curve. The 8 you see here are the first 8 stocks in alphabetical order of the S&P 500, plotted with one segment per day for all trading days in the last decade. Blues are lower values. Oranges are higher values. They have each been normalized internally for their minimum and maximum prices, so the shape of the curve is more important than the maxima or minima.
In this figure, we see two glyphs that are similar: the first and the next to last. These correspond to Agilent and Adobe, respectively. Let’s look at their 5 year charts to see how similar they in fact are:
Now, despite some surface differences, you’ll note that the shapes of the graphs are indeed similar, and that when Agilent goes up, Adobe tends to go up, and when Agilent goes down, Adobe tends to as well. Now, these two companies are unrelated in terms of market sector, so can we really say that these similarities matter? If it were a short trend, maybe not, but this is a 5 year graph that we’re comparing here, and they’re remarkably similar to each other. It’s worth delving deeper into. They could be majority held by the same people, they could track for reasons that aren’t immediately obvious, they could have the many of the same people on their board of directors, or it could in the end be complete coincidence (but paradoxically predictive coincidence).
Here, by the way, for comparison is Apple, the third glyph from the Hilbert graph, shown as an area chart on the same timescale as A and ADBE:
One might expect, considering that the majority of Adobe’s projects run on Apple computers and a majority of Apple computers run Adobe products, that when Apple does well, Adobe does well, and vice versa. We can see that this is not the case. Much as the two Hilbert graphs are unrelated, AAPL and ADBE’s performance are unrelated.
Noe also that I managed to pack 8 timeseries in less space total using the Hilbert glyphs than the Google finance graphs.
And yes, by the way, this was written in Haskell using Hieroglyph. I don’t have the code on me right now, but I’ll post it later on today when I’m in front of my personal computer.