fork download
  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3.  
  4. # Create a figure and axis
  5. fig, ax = plt.subplots()
  6.  
  7. # Set equal aspect so circles look like circles
  8. ax.set_aspect('equal')
  9.  
  10. # Remove axes
  11. ax.axis('off')
  12.  
  13. # Define the rainbow colors (ROYGBIV)
  14. colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
  15.  
  16. # Draw semicircles
  17. for i, color in enumerate(colors):
  18. radius = 10 - i # Decreasing radius for inner arcs
  19. theta = np.linspace(0, np.pi, 100)
  20. x = radius * np.cos(theta)
  21. y = radius * np.sin(theta)
  22. ax.plot(x, y, color=color, linewidth=15)
  23.  
  24. plt.title("🌈 Rainbow Arc with Matplotlib", fontsize=14)
  25. plt.show()
  26.  
Success #stdin #stdout #stderr 3.77s 67704KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Fontconfig error: No writable cache directories