
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Rotate theta=0 on a Matplotlib polar plot
To set theta=0 on a matplotlib polar plot, we can take the following steps −
Create random theta in the range of 0 to 100; convert them into radian.
Using set_theta_zero_location() method, we can set the location of theta to 0.
Plot theta_in_rad and data_r using plot() method.
Set the title of the plot using title() method.
To display the figure, use show() method.
Example
import numpy as np import matplotlib.pyplot as plt import random plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True theta_in_rad = [float(i) * np.pi / 180.0 for i in range(0, 100, 10)] data_r = random.sample(range(70, 90), 10) ax = plt.subplot(111, polar=True) ax.set_theta_zero_location("W") ax.plot(theta_in_rad, data_r, color='r', linewidth=3) ax.set_title("Example", va='bottom') plt.show()
Output
- Related Questions & Answers
- Plot scatter points on polar axis in Matplotlib
- Plot a polar color wheel based on a colormap using Python/Matplotlib
- How to plot sine curve on polar axes using Matplotlib?
- How to curve text in a polar plot in matplotlib?
- How to make the angles in a Matplotlib polar plot go clockwise with 0° at the top?
- How to make a quiver plot in polar coordinates using Matplotlib?
- How to create minor ticks for a polar plot in matplotlib?
- How to plot half or quarter polar plots in Matplotlib?
- How to rotate the rectangle patch in a plot using Matplotlib?
- Plot animated text on the plot in Matplotlib
- How to rotate a simple matplotlib Axes?
- How to create custom markers on a plot in Matplotlib
- How to plot a point on 3D axes in Matplotlib?
- How to embed an interactive Matplotlib plot on a webpage?
- How can I place a table on a plot in Matplotlib?
Advertisements