Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Circular heatmap python

from pylab import *
import numpy as np
from scipy.interpolate import griddata

#create 5000 Random points distributed within the circle radius 100
max_r = 100
max_theta = 2.0 * np.pi
number_points = 5000
points = np.random.rand(number_points,2)*[max_r,max_theta]

#Some function to generate values for these points, 
#this could be values = np.random.rand(number_points)
values = points[:,0] * np.sin(points[:,1])* np.cos(points[:,1])

#now we create a grid of values, interpolated from our random sample above
theta = np.linspace(0.0, max_theta, 100)
r = np.linspace(0, max_r, 200)
grid_r, grid_theta = np.meshgrid(r, theta)
data = griddata(points, values, (grid_r, grid_theta), method='cubic',fill_value=0)

#Create a polar projection
ax1 = plt.subplot(projection="polar")
ax1.pcolormesh(theta,r,data.T)
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: what is norways politics 
Python :: exercism Phone Number python 
Python :: dividing counter object in python 
Python :: block url selenium python 
Python :: pandas join tables based on column of different length 
Python :: what is enumerate in python 
Python :: allala rara 
Python :: django create username and password from csv 
Python :: change alignment of selenium window 
Python :: save changes flask sqlalchemy 
Python :: how i rwrite conditon to create 1 or 0 label from two probability column python 
Python :: django foriegn key filter sample 
Python :: python last letter of string 
Python :: how to find pandoc template folder 
Python :: python x,y,z is d (20, 30, False) 
Python :: optimal alpha jupyter 
Python :: Unpacking list using underscore 
Python :: how to calculate chi square in python 
Python :: python , cv2 change font type 
Python :: pandas column rgeex doesnot contain 
Python :: if condition in python 1 
Python :: python subtract days from date 
Python :: how to access range of tuples in python 
Python :: django queryset with multiple contain keyword 
Python :: flash not defined python flask 
Python :: matplotlib radial averaging 
Python :: python indexing 
Python :: how to reverse a dictionary in python 
Python :: binarize array python 
Python :: playlist discordpy 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =