Tuesday 10 November 2020

Using a linear equation to create a radially interpolated circle

Given a linear equation, I want to use the slope to create a circle of values around a given point, defined by the slope of the linear equation if possible

Im currently a bit far away - can only make the radial plot but do not know how to connect this with an input equation. My first thought would be to change the opacity using import matplotlib.animation as animation and looping matplotlib's alpha argument to become gradually more and more opaque. However the alpha doesnt seem to change opacity.

Code:

# lenth of radius
distance = 200

# create radius 
radialVals = np.linspace(0,distance)

# 2 pi radians = full circle
azm = np.linspace(0, 2 * np.pi)
r, th = np.meshgrid(radialVals, azm)
z = (r ** 2.0) / 4.0

# creates circle
plt.subplot(projection="polar")

# add color gradient
plt.pcolormesh(th, r, z)

plt.plot(azm, r,alpha=1, ls='', drawstyle = 'steps') 

#gridlines
# plt.grid()

plt.show()

enter image description here



from Using a linear equation to create a radially interpolated circle

No comments:

Post a Comment