The answer given by tom10 is ten ;)
But if you want to define the circle (donut) origin is simple, just add the position x,y in the x, yI, yO and -yO and -yI with:
ax.fill_between(x+pos[0], yI+pos[1], yO+pos[1], color=color)
ax.fill_between(x+pos[0], -yO+pos[1], -yI+pos[1], color=color)
As shown below:
import numpy as np
import matplotlib.pyplot as plt
import math
def plot_circle_donut(pos, inner, outer, color):
"""
REF: https://stackoverflow.com/questions/22789356/plot-a-donut-with-fill-or-fill-between-use-pyplot-in-matplotlib
ton10's answer
"""
x = np.linspace(-outer, outer, 300, endpoint=True)
yO = outer * np.sin(np.arccos(x/ outer )) # x-axis values -> outer circle
yI = inner * np.sin(np.arccos(x/ inner )) # x-axis values -> inner circle (with nan's beyond circle)
yI[np.isnan(yI)] = 0. # yI now looks like a boulder hat, meeting yO at the outer points
ax = plt.subplot(111)
ax.fill_between(x+pos[0], yI+pos[1], yO+pos[1], color=color)
ax.fill_between(x+pos[0], -yO+pos[1], -yI+pos[1], color=color)
plt.show()
#
def plot_circle(r, pos):
""" REF: https://math.stackexchange.com/questions/260096/find-the-coordinates-of-a-point-on-a-circle """
arrx = []
arry = []
for theta in xrange(1000):
x,y = r * math.sin(theta), r * math.cos(theta)
arrx.append(x)
arry.append(y)
#
plt.plot(arrx, arry, color='red')
plt.show()
#
#r = 3
#pos = 2,2
#plot_circle(r, pos)
r1, r2 = 2, 2.1
position = [4,2]
color = 'b'
plot_circle_donut(position, r1, r2, color)

REF Example: https://pastebin.com/8Ew4Vthb