Inverse radial axis of the polar section of Matplotlib

I am trying to create an astronomical polar graph with a radial axis that starts from -45 Β° along the outer line and increases to 90 Β° in the center of the plot. But I did not find a way to change the radial axis of the PolarAxes instance. invert_yaxis()the method does not work at all. In addition, there are some hidden methods, such as ax.set_rlim()which do not have any documents.

Here is my current code:

fig = plt.figure()
ax = fig.add_axes([0.1,0.1,0.8,0.8], polar=True)
# ax.invert_yaxis()
ax.set_theta_zero_location('N')
ax.set_ylim(-45, 90)
ax.set_yticks(np.arange(-45, 90, 15))
ax.plot(ras, decs, linestyle='', marker='.')

and my plot

+6
source share
2 answers

"", ( , , ), - :

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_theta_zero_location('N')
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.set_yticklabels(ax.get_yticks()[::-1])
ax.plot([0,10,20], 90-np.array([12,13,14]), linestyle='', marker='.')
fig.show()

enter image description here

+1

, . ax.set_rlim(bottom=90, top=-45). , ax.plot(), .

0

Source: https://habr.com/ru/post/1673454/


All Articles