How can I draw circles with different color gradients, that are high at the center of the circle and low towards its borders?
I can draw, say, 3 circles with different facecolors, using the following code -
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
ellipse1 = patches.Ellipse(xy=(0, 0), width=4, height=4, angle=30, color='r', alpha=0.4)
ellipse2 = patches.Ellipse(xy=(-2, -2), width=4, height=4, angle=30, color='g', alpha=0.4)
ellipse3 = patches.Ellipse(xy=(3, -2), width=4, height=4, angle=30, color='b', alpha=0.4)
fig, ax = plt.subplots()
ax.set_xlim((-5, 5))
ax.set_ylim((-5, 5))
ax.add_patch(ellipse1)
ax.add_patch(ellipse2)
ax.add_patch(ellipse3)
plt.show()
So I get the following output -
I want to color the circles with red, green and blue color gradients instead, that are high at the center and low at the borders.
Is there a minimal way to change the existing code to do that?