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

Appearance settings

Remove some usages of plt.setp() #20654

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
Jul 16, 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
4 changes: 2 additions & 2 deletions 4 examples/axes_grid1/demo_axes_divider.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def demo_simple_image(ax):

im = ax.imshow(Z, extent=extent)
cb = plt.colorbar(im)
plt.setp(cb.ax.get_yticklabels(), visible=False)
cb.ax.yaxis.set_tick_params(labelright=False)


def demo_locatable_axes_hard(fig):
Expand Down Expand Up @@ -60,7 +60,7 @@ def demo_locatable_axes_hard(fig):

im = ax.imshow(Z, extent=extent)
plt.colorbar(im, cax=ax_cb)
plt.setp(ax_cb.get_yticklabels(), visible=False)
ax_cb.yaxis.set_tick_params(labelright=False)


def demo_locatable_axes_easy(ax):
Expand Down
8 changes: 2 additions & 6 deletions 8 examples/axes_grid1/inset_locator_demo2.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ def get_demo_image():
# fix the number of ticks on the inset axes
axins.yaxis.get_major_locator().set_params(nbins=7)
axins.xaxis.get_major_locator().set_params(nbins=7)

plt.setp(axins.get_xticklabels(), visible=False)
plt.setp(axins.get_yticklabels(), visible=False)
axins.tick_params(labelleft=False, labelbottom=False)


def add_sizebar(ax, size):
Expand Down Expand Up @@ -69,9 +67,7 @@ def add_sizebar(ax, size):
# fix the number of ticks on the inset axes
axins2.yaxis.get_major_locator().set_params(nbins=7)
axins2.xaxis.get_major_locator().set_params(nbins=7)

plt.setp(axins2.get_xticklabels(), visible=False)
plt.setp(axins2.get_yticklabels(), visible=False)
axins2.tick_params(labelleft=False, labelbottom=False)

# draw a bbox of the region of the inset axes in the parent axes and
# connecting lines between the bbox and the inset axes area
Expand Down
5 changes: 3 additions & 2 deletions 5 examples/event_handling/ginput_manual_clabel_sgskip.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ def tellme(s):
# Define a triangle by clicking three points


plt.clf()
plt.setp(plt.gca(), autoscale_on=False)
plt.figure()
plt.xlim(0, 1)
plt.ylim(0, 1)

tellme('You will define a triangle, click to begin')

Expand Down
3 changes: 1 addition & 2 deletions 3 examples/images_contours_and_fields/contour_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@
linewidths=2, extent=(-3, 3, -2, 2))

# Thicken the zero contour.
zc = CS.collections[6]
plt.setp(zc, linewidth=4)
CS.collections[6].set_linewidth(4)

ax.clabel(CS, levels[1::2], # label every second level
inline=True, fmt='%1.1f', fontsize=14)
Expand Down
4 changes: 2 additions & 2 deletions 4 examples/subplots_axes_and_figures/shared_axis_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@

ax1 = plt.subplot(311)
plt.plot(t, s1)
plt.setp(ax1.get_xticklabels(), fontsize=6)
plt.tick_params('x', labelsize=6)

# share x only
ax2 = plt.subplot(312, sharex=ax1)
plt.plot(t, s2)
# make these tick labels invisible
plt.setp(ax2.get_xticklabels(), visible=False)
plt.tick_params('x', labelbottom=False)

# share x and y
ax3 = plt.subplot(313, sharex=ax1, sharey=ax1)
Expand Down
4 changes: 2 additions & 2 deletions 4 examples/ticks_and_spines/date_precision_and_epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def _reset_epoch_for_tutorial():
fig, ax = plt.subplots(constrained_layout=True)
ax.plot(xold, y)
ax.set_title('Epoch: ' + mdates.get_epoch())
plt.setp(ax.xaxis.get_majorticklabels(), rotation=40)
ax.xaxis.set_tick_params(rotation=40)
plt.show()

#############################################################################
Expand All @@ -140,7 +140,7 @@ def _reset_epoch_for_tutorial():
fig, ax = plt.subplots(constrained_layout=True)
ax.plot(x, y)
ax.set_title('Epoch: ' + mdates.get_epoch())
plt.setp(ax.xaxis.get_majorticklabels(), rotation=40)
ax.xaxis.set_tick_params(rotation=40)
plt.show()

_reset_epoch_for_tutorial() # Don't do this. Just for this tutorial.
Expand Down
10 changes: 4 additions & 6 deletions 10 lib/matplotlib/tests/test_polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,13 @@ def test_polar_interpolation_steps_constant_r(fig_test, fig_ref):
# Check that an extra half-turn doesn't make any difference -- modulo
# antialiasing, which we disable here.
p1 = (fig_test.add_subplot(121, projection="polar")
.bar([0], [1], 3*np.pi, edgecolor="none"))
.bar([0], [1], 3*np.pi, edgecolor="none", antialiased=False))
p2 = (fig_test.add_subplot(122, projection="polar")
.bar([0], [1], -3*np.pi, edgecolor="none"))
.bar([0], [1], -3*np.pi, edgecolor="none", antialiased=False))
p3 = (fig_ref.add_subplot(121, projection="polar")
.bar([0], [1], 2*np.pi, edgecolor="none"))
.bar([0], [1], 2*np.pi, edgecolor="none", antialiased=False))
p4 = (fig_ref.add_subplot(122, projection="polar")
.bar([0], [1], -2*np.pi, edgecolor="none"))
for p in [p1, p2, p3, p4]:
plt.setp(p, antialiased=False)
.bar([0], [1], -2*np.pi, edgecolor="none", antialiased=False))


@check_figures_equal(extensions=["png"])
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.