reverse radial axes of matplotlib polar plot

  • Last Update :
  • Techknowledgy :

It's a little bit "hacky", but if you know the bounds (which it seems like you do as it corresponds to declination) you could do something like:

import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar = True)
# ax.invert_yaxis()
ax.set_rlim(90, -45, 1)
# Note: you must set the end of arange to be slightly larger than 90 or it won 't include 90
ax.set_yticks(np.arange(-45, 91, 15))
ax.plot([0, 10, 20], 90 - np.array([12, 13, 14]), linestyle = '', marker = '.')

Suggestion : 2

The use of the following functions, methods, classes and modules is shown in this example:,Demo of a line plot on a polar axis., Controlling the position and size of colorbars with Inset Axes , Demo of the histogram function's different histtype settings

import numpy as np
import matplotlib.pyplot as plt

r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r

fig, ax = plt.subplots(subplot_kw = {
   'projection': 'polar'
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2]) # Less radial ticks
ax.set_rlabel_position(-22.5) # Move radial labels away from plotted line

ax.set_title("A line plot on a polar axis", va = 'bottom')

Suggestion : 3

Plot a line in polar coordinates and add a title.,You can modify certain aspects of polar axes in order to make the chart more readable. For example, you can change the grid line locations and associated labels. You also can change the grid line colors and label font size. ,Display lines along the theta-axis every 45 degrees. Specify the locations as a vector of increasing values. ,Use different colors for the theta-axis and r-axis grid lines and associated labels by setting the ThetaColor and RColor properties. Change the width of the grid lines by setting the LineWidth property.

theta = linspace(0, 2 * pi);
rho = 2 * theta;
polarplot(theta, rho)
title('My Polar Plot')
pax = gca
pax =
   PolarAxes(My Polar Plot) with properties:

   ThetaLim: [0 360]
RLim: [0 14]
ThetaAxisUnits: 'degrees'
ThetaDir: 'counterclockwise'
ThetaZeroLocation: 'right'

Show all properties
pax.FontSize = 14;
thetaticks(0: 45: 315)
pax = gca;
pax.ThetaAxisUnits = 'radians';