Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8a3bdfc

Browse files
Phil Elsonpelson
Phil Elson
authored andcommitted
Fixed polar resolution handling. All tests passing (9 known fails).
1 parent 1b44a78 commit 8a3bdfc

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

‎lib/matplotlib/projections/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ def process_projection_requirements(figure, *args, **kwargs):
110110
projection)
111111
projection = 'polar'
112112

113+
# ensure that the resolution keyword is always put into the key
114+
# for polar plots [so that the result of
115+
# plt.subplot(111, projection='polar') can be found with
116+
# plt.gca(projection='polar', resolution=1)]
117+
if projection == 'polar':
118+
kwargs.setdefault('resolution', 1)
119+
113120
if isinstance(projection, basestring) or projection is None:
114121
projection_class = get_projection_class(projection)
115122
elif hasattr(projection, '_as_mpl_axes'):

‎lib/matplotlib/projections/polar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ def __init__(self, *args, **kwargs):
229229
each pair of data points. Set to 1 to disable
230230
interpolation.
231231
"""
232-
233-
self.resolution = kwargs.pop('resolution', None)
232+
self._rpad=0.05
233+
self.resolution = kwargs.pop('resolution', 1)
234234
self._default_theta_offset = kwargs.pop('theta_offset', 0)
235235
self._default_theta_direction = kwargs.pop('theta_direction', 1)
236236

‎lib/matplotlib/pyplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,7 @@ def polar(*args, **kwargs):
20632063
interpolate between each pair of points. The default is 1,
20642064
which disables interpolation.
20652065
"""
2066-
resolution = kwargs.pop('resolution', None)
2066+
resolution = kwargs.pop('resolution', 1)
20672067
ax = gca(polar=True, resolution=resolution)
20682068
ret = ax.plot(*args, **kwargs)
20692069
draw_if_interactive()

‎lib/matplotlib/tests/test_axes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ def test_const_xy():
264264
plt.subplot( 313 )
265265
plt.plot( np.ones( (10,) ), np.ones( (10,) ), 'o' )
266266

267+
267268
@image_comparison(baseline_images=['polar_wrap_180',
268269
'polar_wrap_360',
269270
])
@@ -273,10 +274,11 @@ def test_polar_wrap():
273274
fig = plt.figure()
274275

275276
plt.subplot(111, polar=True)
277+
276278
plt.polar( [179*D2R, -179*D2R], [0.2, 0.1], "b.-" )
277279
plt.polar( [179*D2R, 181*D2R], [0.2, 0.1], "g.-" )
278280
plt.rgrids( [0.05, 0.1, 0.15, 0.2, 0.25, 0.3] )
279-
281+
assertlen(fig.axes) ==1, 'More than one polar axes created.'
280282
fig = plt.figure()
281283

282284
plt.subplot( 111, polar=True)
@@ -285,6 +287,7 @@ def test_polar_wrap():
285287
plt.polar( [358*D2R, 2*D2R], [0.2, 0.1], "r.-" )
286288
plt.rgrids( [0.05, 0.1, 0.15, 0.2, 0.25, 0.3] )
287289

290+
288291
@image_comparison(baseline_images=['polar_units', 'polar_units_2'],
289292
freetype_version=('2.4.5', '2.4.9'))
290293
def test_polar_units():

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /