- 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
Plot a polar color wheel based on a colormap using Python/Matplotlib
To plot a color wheel based on a colormap using Python/Matplotlib, we can use the colorbar class and can use copper colormap.
Steps
Set the figure size and adjust the padding between and around the subplots.
Create a new figure or activate an existing figure using figure() method.
Add an axes to the figure using add_axes() method.
Set the direction of the axes.
Linearly normalize the data using Normalize class.
Draw a colorbar in an existing axes.
Set the artist's visibility.
Turn the X- and Y-axis off.
To display the figure, use show() method.
Example
import numpy as np from matplotlib import pyplot as plt, cm, colors, colorbar plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig = plt.figure() display_axes = fig.add_axes([0.1, 0.1, 0.8, 0.8], projection='polar') display_axes._direction = 2 * np.pi norm = colors.Normalize(0.0, 2 * np.pi) cb = colorbar.ColorbarBase(display_axes, cmap=cm.get_cmap('copper', 2056), norm=norm, orientation='horizontal') cb.outline.set_visible(False) display_axes.set_axis_off() plt.show()
Output
- Related Articles
- Rotate theta=0 on a Matplotlib polar plot
- How to plot sine curve on polar axes using Matplotlib?
- Plot a multicolored line based on a condition in Python Matplotlib
- How to shade points in a scatter based on colormap in Matplotlib?
- Plot scatter points on polar axis in Matplotlib
- How to make a quiver plot in polar coordinates using Matplotlib?
- Plot a histogram with colors taken from colormap in Matplotlib
- Matplotlib Plot Lines with Colors through Colormap
- How to redefine a color for a specific value in a Matplotlib colormap?
- How to curve text in a polar plot in matplotlib?
- How to change the face color of a plot using Matplotlib?
- How to create minor ticks for a polar plot in matplotlib?
- How to color a Seaborn boxplot based on DataFrame column name in Matplotlib?
- Controlling the alpha value on a 3D scatter plot using Python and Matplotlib
- How to plot a gradient color line in matplotlib?

Advertisements