1

I have a plot of two circles with different radii. I want to fill the region between them with a solid color. How can I do this?

What I have: enter image description here

What i want: enter image description here

import matplotlib.pyplot as plt
import numpy as np

raio_1  = 10
centro_1 = (0, 0)
theta_1 = np.linspace(0, 2 * np.pi, 100) 
x_1 = centro_1[0] + raio_1 * np.cos(theta_1)
y_1 = centro_1[1] + raio_1 * np.sin(theta_1)

raio_2  = 5
centro_2 = (0, 0)
theta_2 = np.linspace(0, 2 * np.pi, 100) 
x_2 = centro_2[0] + raio_2 * np.cos(theta_2)
y_2 = centro_2[1] + raio_2 * np.sin(theta_2)

# Plotagem
plt.figure(figsize=(6, 6))
plt.plot(x_1, y_1, color="C0")
plt.plot(x_2, y_2, color="C0")
plt.axis('equal')
plt.show()

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158

0 Answers0