python - Polar plot with a 'floating' radial axis -
i'm working on figure consisting of large number of polar plots in grid, of share common scale in radial axis. each plot needs quite small in order fit figure, when scale down dimensions of axes, tick labels radial axis crowded , illegible, , obscure data i'm trying plot.
for example:
import numpy np matplotlib import pyplot plt fig, axes = plt.subplots(1, 4, figsize=(9, 2), subplot_kw=dict(polar=true)) theta = np.r_[np.linspace(0, 2*np.pi, 12), 0] aa in axes.flat: x = np.random.rand(12) aa.plot(theta, np.r_[x, x[0]], '-sb') aa.set_rlim(0, 1) fig.subplots_adjust(left=0.1, right=0.9, bottom=0.1, top=0.9, wspace=0.5)
i realise problem can partly mitigated reducing font size , number of radial ticks, i'd prefer avoid having tick labels overlapping data altogether. instead i'd have single 'floating' radial axis sits outside plot, this:
with normal cartesian plot use ax.spine['left'].set_position(...)
, polaraxessubplot
has single u'polar'
spine cannot offset. there 'nice' way create floating radial axis polar plot, ideally such scale , limits updated match changes radial axis of polar plot itself?
this not want, may give hint how position labels polar axis:
import numpy np matplotlib import pyplot plt fig, axes = plt.subplots(1, 4, figsize=(9, 2), subplot_kw=dict(polar=true)) theta = np.r_[np.linspace(0, 2*np.pi, 12), 0] aa in axes.flat: x = np.random.rand(12) aa.plot(theta, np.r_[x, x[0]], '-sb') aa.set_rlim(0, 1) plt.draw() ax = axes[-1] r, t in zip(ax.yaxis.get_ticklocs(), ax.yaxis.get_ticklabels()): ax.text(np.pi/2, r, '$\cdot$'*20 + t.get_text(), ha='left', va='center', fontsize=10, color='0.25') ax in axes: ax.yaxis.set_ticklabels([]) fig.subplots_adjust(left=0.1, right=0.9, bottom=0.1, top=0.9, wspace=0.5) fig.savefig('test.png', bbox_inches='tight')
Comments
Post a Comment