- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to plot a rainbow cricle in matplotlib?
To plot a rainbow circles in Matplotlib, we can take the following steps −
- Set the figure size and adjust the padding between and around the subplots.
- Create a figure and a set of subplots.
- Set the X and Y axes scale.
- Make a list of rainbow colors.
- Create a true circle at (0, 0).
- Add a circle instance 'c' to the figure.
- To display the figure, use show() method.
Example
import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 5.50] plt.rcParams["figure.autolayout"] = True fig, ax = plt.subplots() plt.axis("equal") ax.set(xlim=(-10, 10), ylim=(-10, 10)) for i in range(0, 7): rainbow = ['violet', 'indigo', 'blue', 'green', 'yellow', 'orange', 'red'] c = plt.Circle((0, 0), 7-i, fill=True, color=rainbow[i]) ax.add_artist(c) plt.show()
Output
It will produce the following output
- Related Articles
- How to plot a multi-colored line, like a rainbow using Matplotlib?
- How to fill rainbow color under a curve in Python Matplotlib?
- How to a plot stem plot in Matplotlib Python?
- How to plot a circle in Matplotlib?
- How to remove lines in a Matplotlib plot?
- How to animate a scatter plot in Matplotlib?
- How to plot a watermark image in Matplotlib?
- How to plot a 2D histogram in Matplotlib?
- How to animate a line plot in Matplotlib?
- How to make a rug plot in Matplotlib?
- How to make a mosaic plot in Matplotlib?
- How to surface plot/3D plot from a dataframe (Matplotlib)?
- How to plot matplotlib contour?
- How to plot a high resolution graph in Matplotlib?
- How to plot a 3D patch collection in matplotlib?

Advertisements