Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Prefer projection="polar" over polar=True. #19502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/pie_and_polar_charts/nested_pie.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
# a circle. The cumulative sum of the values are used as the edges
# of the bars.

fig, ax = plt.subplots(subplot_kw=dict(polar=True))
fig, ax = plt.subplots(subplot_kw=dict(projection="polar"))

size = 0.3
vals = np.array([[60., 32.], [37., 40.], [29., 10.]])
Expand Down
4 changes: 2 additions & 2 deletions examples/pie_and_polar_charts/polar_scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# rotate the plot.

fig = plt.figure()
ax = fig.add_subplot(polar=True)
ax = fig.add_subplot(projection='polar')
c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75)

ax.set_rorigin(-2.5)
Expand All @@ -47,7 +47,7 @@
# theta start and end limits, producing a sector instead of a full circle.

fig = plt.figure()
ax = fig.add_subplot(polar=True)
ax = fig.add_subplot(projection='polar')
c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75)

ax.set_thetamin(45)
Expand Down
2 changes: 1 addition & 1 deletion examples/pyplots/annotation_polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(polar=True)
ax = fig.add_subplot(projection='polar')
r = np.arange(0, 1, 0.001)
theta = 2 * 2*np.pi * r
line, = ax.plot(theta, r, color='#ee8d18', lw=3)
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ def subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
ax2.scatter(x, y)

# Create four polar Axes and access them through the returned array
axes = fig.subplots(2, 2, subplot_kw=dict(polar=True))
axes = fig.subplots(2, 2, subplot_kw=dict(projection='polar'))
axes[0, 0].plot(x, y)
axes[1, 1].scatter(x, y)

Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
ax2.scatter(x, y)

# Create four polar axes and access them through the returned array
fig, axs = plt.subplots(2, 2, subplot_kw=dict(polar=True))
fig, axs = plt.subplots(2, 2, subplot_kw=dict(projection="polar"))
axs[0, 0].plot(x, y)
axs[1, 1].scatter(x, y)

Expand Down Expand Up @@ -2426,7 +2426,7 @@ def polar(*args, **kwargs):
else:
_api.warn_external('Trying to create polar plot on an Axes '
'that does not have a polar projection.')
ax = axes(polar=True)
ax = axes(projection="polar")
ret = ax.plot(*args, **kwargs)
return ret

Expand Down