Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import sympy
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as ani'dark_background')
def convert_to_polar_coordinates(num):
return num*np.cos(num), num*np.sin(num)
lim = 10000
fig, ax = plt.subplots(figsize = (8, 8))
primes = sympy.primerange(0, lim)
primes = np.array(list(primes))
x, y = convert_to_polar_coordinates(primes)
def init():
ax.plot([], [])
def plot_in_polar(i):
ax.plot(x[:i], y[:i], linestyle='', marker='o', markersize=0.75, c='#FFFFFF')
ax.set_xlim(-lim, lim)
ax.set_ylim(-lim, lim)
animator = ani.FuncAnimation(fig=fig, func=plot_in_polar, interval=1, frames=len(primes))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment