python - Matplotlib density plot in polar coordinates? -
i have array saved txt file has entries corresponding value of distribution in polar coordinates. looks this:
f(r1,theta1) f(r1, theta2) ..... f(r1, theta_max) f(r2,theta1) f(r2, theta2) ..... . . . . . . . f(r_max,theta1) .................f(r_max, theta_max)
i want density plot of f (the higher f is, more red want color be). there way matplotlib? explicit code helpful, majorly new this.
in example, a
theta1...thetan, b
r1...rn, c
f(a, b):
#fake data: = np.linspace(0,2*np.pi,50) b = np.linspace(0,1,50) a, b = np.meshgrid(a, b) c = np.random.random(a.shape) #actual plotting import matplotlib.cm cm ax = plt.subplot(111, polar=true) ax.set_yticklabels([]) ctf = ax.contourf(a, b, c, cmap=cm.jet) plt.colorbar(ctf)
essentially filled contour plot in polar axis. can specify alternative colormap cmap=...
. cm.jet
goes blue red, red being largest value.
Comments
Post a Comment