analistica/ex-3/plot.py

33 lines
872 B
Python
Raw Permalink Normal View History

2020-03-06 02:24:32 +01:00
#!/usr/bin/env python
from pylab import *
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import sys
bins = tuple(map(int, sys.stdin.readline().split()))
2020-03-06 02:24:32 +01:00
xedges, yedges, counts = loadtxt(sys.stdin, unpack=True, usecols=[0,2,4])
counts = counts.reshape(bins)
2020-05-27 22:49:36 +02:00
plt.rcParams['font.size'] = 12
2020-03-06 02:24:32 +01:00
suptitle('Angular decay distribution')
#subplot2grid((1, 3), (0, 0), colspan=2, aspect='equal')
2020-03-06 02:24:32 +01:00
xlabel(r'$\phi$ (radians)')
ylabel(r'$\theta$ (radians)')
pcolor(yedges[:bins[1]], xedges[::bins[1]], counts)
norm = colorbar(fraction=0.023, pad=0.04).norm
#ax = subplot2grid((1, 3), (0, 2), projection='3d')
#θ, φ = mgrid[0:pi:bins[0]*1j, 0:2*pi:bins[1]*1j]
#x = 5 * sin(θ) * cos(φ)
#y = 5 * sin(θ) * sin(φ)
#z = 5 * cos(θ)
#ax.plot_surface(
# x, y, z, rstride=1, cstride=1,
# facecolors=cm.viridis(norm(counts)))
#axis('off')
2020-05-11 23:28:23 +02:00
2020-05-27 22:49:36 +02:00
tight_layout()
2020-03-06 02:24:32 +01:00
show()