Matplotlib で極座標の図を作る (例題; コンプトン散乱の断面積)
python の matplotlib (もしくは pylab)で極座標系での図を作ってみた。
単なる遊び。
で定義されるコンプトン散乱の式をプロットしてみよう。
なお、線の色は以下を参考にするとよい。
http://html-color-codes.com/
import pylab import math def cross_section(gamma, theta): factor1 = (1 + math.cos(theta)**2)/(2*(1+gamma*(1-math.cos(theta)))**2) factor2 = 1 + (gamma**2*(1-math.cos(theta))**2)/((1+math.cos(theta)**2)*(1+gamma*(1-math.cos(theta)))) norm_cross_section = factor1 * factor2 # dsigma/dOmega; in a unit of r_0^2 return norm_cross_section fig = pylab.figure(figsize=(8,8)) ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True) pylab.rc('grid', linewidth=1, linestyle='-') pylab.rc('xtick', labelsize=15) pylab.rc('ytick', labelsize=15) xmin = 0 xmax = 360 x = pylab.arange(xmin, xmax, 0.10) ang = [math.radians(i) for i in x] y1 = [cross_section(0, math.radians(i)) for i in x] y2 = [cross_section(0.1, math.radians(i)) for i in x] y3 = [cross_section(1.0, math.radians(i)) for i in x] ax.plot(ang, y1, color='#ee8d18', lw=2, label='$\gamma=0$') ax.plot(ang, y2, color='#6E66AD', lw=2, label='$\gamma=0.1$') ax.plot(ang, y3, color='#87B432', lw=2, label='$\gamma=1.0$') ax.legend() fig.savefig("compton_cross_section_polar.png", format='png')