R axis ticks not displaying on polar log plot

803 views Asked by At

I'm making a logarithmic polar plot in Matplotlib, and for some reason after switching to "log=True" my raxis ticks disappeared. Here is my plotting code:

# <Matplotlib imports...>

ax = subplot(111, polar=True)
ax.set_yscale('log')
ax.set_ylim(0,.04)
plt.scatter(dra, dphys, c="red", cmap=cm.hsv)
plt.scatter(wra, wphys, cmap=cm.hsv)
ax.set_xticklabels(['0','3','6','9','12','15','18','21'])
ax.set_yticklabels(['1','5','10','30','100','1000','10000'])

show()

As you can see by that final line, those are the ticks I'd like to show up on it. How can I make this work?

Picture of plot

1

There are 1 answers

1
Serenity On

Set log scale after plot and use xticks.

from matplotlib.pylab import *

r = np.arange(0., 10000., .01)
phi = 5. * np.pi * r

ax = subplot(111, polar=True)
ax.plot(phi, r, color='r', linewidth=1.5)
ax.set_xticklabels(['0','3','6','9','12','15','18','21'])
ax.set_yscale('log')
ax.set_yticks([1,5,10,30,100,1000,10000])
ax.set_rlabel_position(60)
show()

enter image description here