Aligning two line plots


having looked through the available plugins without success, I try this way to find a solution to the following problem.

I have two line graphs (and the associated tables). One is the measurement, which is noisy, the other is the model with much less noise. I want to subtract the model from the measurement, but the measurement has some arbitrary shift in the x-direction with respect to the model.

I am looking for a way to correlate the model with the measurement and derive an optimum value for the shift between the two.

Many thanks in advance for any suggestions!

Best wishes


PS: I am using imageJ 1.52p on WIndows10, 64bit

Convolution is probably what you want. The second visualisation example is what you are looking for. The better the two functions fit, the higher the (curve in black) is. The visualisation is also a good lead on how to implement this with two arrays, one with the experiment, the other with the model.

Thank you for pointing to the Wikipedia article on convolution. I had thought of convolution but had hoped there would be an imageJ plugin readily available. :slight_smile:


One approach that should work is Phase Correlation (
In python I would either use imreg or
skimage’s register translation.
It should work for images with dimensions (n,1).

I’m not that familiar with the image J ecosystem but Correct 3D Drift uses phase correlation and you may be able to wrangle your two line plots into a t=2, x=n, y=1 dimensional time series to align your two signals.

Hi @Jossie

If you use the position correction plug-in for the image, how about converting the data into an image once and using each plug-in?(using import text etc)
Then I think it would be good to take the difference between the images.


@VolkerH , @hwada

Thanks a lot for your suggestions. I will look into these and see where I can get.

In the meantime I also found a possible solution in the book by Burger & Burge (2016). In their chapter 23 “Image Matching and Registration” may be something I can use. But I will need some time to study this text.