I have four one dimensional lists: X1, Y1, X2, Y2.
I want to graph Y1 vs Y2.
I can plot just fine once I get the interpolated data, but can't think of how to interpolate data. I've thought and researched this a couple hours, and just can't figure it out. I don't mind a linear interpolation, but just can't figure out a way.
I think this is what you want:
import numpy as np
import matplotlib.pyplot as plt
# first data set
X1 = np.linspace(0,1,203)
Y1 = np.sin(X1)
# second data set
X2 = np.linspace(0, 0.5, 1532)
Y2 = np.cos(X2)
# get interpolated values of Y1 evaluated at X2
Y1_interp = np.interp(X2, X1, Y1)
# plot interpolated Y1 vs Y2
plt.plot(Y1_interp, Y2)
plt.show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With