Learn how to make a 2D contour plot in Python in polar coordinates.
Script can be found here: https://www.hageslab.com/Resources.ht...
Here we are using "Spyder" IDE with the numpy and matplotlib libraries
Script:
import numpy as np
import matplotlib.pylab as plt
def T(theta,a,b):
return a*np.sin(theta*b)
def R(r,c,d):
return c*np.cos(r*d)
rlist=np.arange(0,4.01,0.01) #Angstroms
thetalist=np.radians(np.arange(0,361,1)) #Radians
rmesh, thetamesh = np.meshgrid(rlist, thetalist) #Generate a mesh
a = 1.5
b = 2
c = 2
d = 1.6
FullFunction = T(thetamesh,a,b)*R(rmesh,c,d)
FullFunction2 = FullFunction**2*rlist**2
fig, ax = plt.subplots(dpi=120,subplot_kw=dict(projection='polar'))
ax.contourf(thetamesh, rmesh, FullFunction, 100, cmap='plasma')
fig, ax = plt.subplots(dpi=120,subplot_kw=dict(projection='polar'))
ax.contourf(thetamesh, rmesh, FullFunction2, 100, cmap='plasma')
Auf dieser Seite können Sie das Online-Video How to: Make a Polar Plot in Python mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer HagesLab 03 September 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 17,988 Mal angesehen und es wurde von 171 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!