matplotlib/matplotlib — Issue #680: polar axes labels error with small radial range
Author: phobson
Created: 2012-01-17 01:46:46+00:00
State: open

Hey there. When you run this example: http://matplotlib.sourceforge.net/examples/pylab_examples/polar_demo.html

and replace "ax.set_rmax(3.0)" with "ax.set_rmin(2.91); ax.set_rmax(3.01)" the r-axis labels move off of the axis.

Full example below (with the figsize changed to show where the labels go:
import matplotlib
import numpy as np
from matplotlib.pyplot import figure, show, rc, grid

# radar green, solid grid lines
rc('grid', color='#316931', linewidth=1, linestyle='-')
rc('xtick', labelsize=15)
rc('ytick', labelsize=15)

# force square figure and square axes looks better for polar, IMO
#width, height = matplotlib.rcParams['figure.figsize']
#size = min(width, height)
# make a square figure
fig = figure(figsize=(6, 4))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c')

r = np.arange(0, 3.0, 0.01)
theta = 2*np.pi*r
ax.plot(theta, r, color='#ee8d18', lw=3)
ax.set_rmin(2.91)
ax.set_rmax(3.01)
grid(True)

ax.set_title("And there was much rejoicing!", fontsize=20)
show()