import numpy as np
from scipy import interpolate
import matplotlib.pyplot as plt
import matplotlib.cm as cm
data = np.loadtxt('data.csv', delimiter=',')
data_x = np.loadtxt('xy.csv', delimiter=',')[:,0]
data_y = np.loadtxt('xy.csv', delimiter=',')[:,0][::-1]
f_r = interpolate.interp2d(data_x, data_y, data, kind='linear')
t = np.linspace(0, 2*np.pi, 100)
r = np.linspace(0, data_x.max(), 100)
T, R = np.meshgrid(t, r)
Z = np.array([[f_r(i*np.cos(j), i*np.sin(j))[0] for j in t] for i in r])
deg1 = 0
Z_1d_1 = np.array([f_r(i*np.cos(deg1*np.pi/180), i*np.sin(deg1*np.pi/180))[0] for i in data_x])
deg2 = 90
Z_1d_2 = np.array([f_r(i*np.cos(deg2*np.pi/180), i*np.sin(deg2*np.pi/180))[0] for i in data_x])
ax = plt.subplot(211, polar=True)
ctf = ax.contourf(T, R, Z, 100, cmap=cm.jet)
colb = plt.colorbar(ctf, pad=0.15,orientation="vertical")
ax = plt.subplot(212)
ax.plot(data_x, Z_1d_1)
ax.plot(data_x, Z_1d_2)
plt.show()