#!/usr/bin/python3

print('*** Zgled polar density plot - 28.09.2020 ***')
#https://stackoverflow.com/questions/9071084/polar-contour-plot-in-matplotlib-best-modern-way-to-do-it
#https://stackoverflow.com/questions/19248787/build-up-and-plot-matplotlib-2d-histogram-in-polar-coordinates-using-the-legendr
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm

#-- Generate Data -----------------------------------------
# Using linspace so that the endpoint of 360 is included...
azimuths=np.radians(np.linspace(0,360,400))
zeniths=np.arange(0,70,2)

r,theta=np.meshgrid(zeniths, azimuths)
values=np.random.random((azimuths.size,zeniths.size))

#-- Plot... ------------------------------------------------
fig,ax=plt.subplots(subplot_kw=dict(projection='polar'))
pax=ax.pcolormesh(theta,r,values,cmap=cm.cool) #https://matplotlib.org/3.1.0/tutorials/colors/colormaps.html#colorcet

ax.set_theta_zero_location("S") # 'south' location for theta=0
ax.set_theta_direction(-1)      # angles increase clockwise
fig.colorbar(pax)

plt.show()

print('*** Konec ***')
