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')
Sur cette page du site, vous pouvez voir la vidéo en ligne How to: Make a Polar Plot in Python durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur HagesLab 03 septembre 2020, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 17,988 fois et il a aimé 171 téléspectateurs. Bon visionnage!