Solved – How to display magnitude of change over time between two series

data visualizationmatplotlibpythontime series

Disclaimer: I know absolutely nothing about statistics. I've had trouble searching for answers to my question, as I don't have much knowledge about the terminology of statistics.

I'm currently trying to plot a graph with two sets of values that are widely different. This doesn't really matter, but I'm doing this in Python with the matplotlib library.

One of my sets of values is a company's stock price over several days. My second set of data has much, much smaller values, but I'd like to be able to compare both lines side by side. I'm more interested in the magnitude of the changes than in the actual values.

For the moment, the only idea I've had is the following:

  • Average the first values.

  • Average the second values.

  • Divide the first average by the second one, as to find a coefficient.

  • Divide every single value in the first set of data by this coefficient.

Now, this looks fine, but I don't know anything about statistics, so is this correct? If it isn't, what's a better way to do it?

Best Answer

If you are interested in the changes as a fraction, then simply plot the logarithm of the values. A fixed distance in log space is a fixed fractional change, so if one line is steeper than the other it is changing more rapidly.

The log scale may also allow you to conveniently get both sets of values onto one graph without having to normalize the values in any way.

Related Question