Skip to content

Use ticklabels([]) instead of ticklabels('') #20632

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 12, 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 examples/subplots_axes_and_figures/zoom_inset_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def get_demo_image():
x1, x2, y1, y2 = -1.5, -0.9, -2.5, -1.9
axins.set_xlim(x1, x2)
axins.set_ylim(y1, y2)
axins.set_xticklabels('')
axins.set_yticklabels('')
axins.set_xticklabels([])
axins.set_yticklabels([])

ax.indicate_inset_zoom(axins, edgecolor="black")

Expand Down
4 changes: 2 additions & 2 deletions examples/text_labels_and_annotations/mathtext_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def doall():
plt.gca().set_ylim(0., 1.)
plt.gca().set_title("Matplotlib's math rendering engine",
color=mpl_grey_rvb, fontsize=14, weight='bold')
plt.gca().set_xticklabels("", visible=False)
plt.gca().set_yticklabels("", visible=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is visible=False doing here?/is it okay that it's dropped?

Copy link
Member Author

@timhoffm timhoffm Jul 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sets all of the 0 created ticklabels to invisible 🙃 , i.e. does nothing.

plt.gca().set_xticklabels([])
plt.gca().set_yticklabels([])

# Gap between lines in axes coords
line_axesfrac = 1 / n_lines
Expand Down
1 change: 1 addition & 0 deletions lib/matplotlib/projections/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def set_yscale(self, *args, **kwargs):
set_xscale = set_yscale

def set_xlim(self, *args, **kwargs):
"""Not supported. Please consider using Cartopy."""
raise TypeError("Changing axes limits of a geographic projection is "
"not supported. Please consider using Cartopy.")

Expand Down
8 changes: 4 additions & 4 deletions lib/matplotlib/tests/test_constrainedlayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def example_plot(ax, fontsize=12, nodec=False):
ax.set_ylabel('y-label', fontsize=fontsize)
ax.set_title('Title', fontsize=fontsize)
else:
ax.set_xticklabels('')
ax.set_yticklabels('')
ax.set_xticklabels([])
ax.set_yticklabels([])


def example_pcolor(ax, fontsize=12):
Expand Down Expand Up @@ -428,8 +428,8 @@ def test_colorbar_align():
if nn != 1:
cb.ax.xaxis.set_ticks([])
cb.ax.yaxis.set_ticks([])
ax.set_xticklabels('')
ax.set_yticklabels('')
ax.set_xticklabels([])
ax.set_yticklabels([])
fig.set_constrained_layout_pads(w_pad=4 / 72, h_pad=4 / 72, hspace=0.1,
wspace=0.1)

Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/tests/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,12 +636,12 @@ def test_large_subscript_title():
ax = axs[0]
ax.set_title(r'$\sum_{i} x_i$')
ax.set_title('New way', loc='left')
ax.set_xticklabels('')
ax.set_xticklabels([])

ax = axs[1]
ax.set_title(r'$\sum_{i} x_i$', y=1.01)
ax.set_title('Old Way', loc='left')
ax.set_xticklabels('')
ax.set_xticklabels([])


def test_wrap():
Expand Down
4 changes: 2 additions & 2 deletions tutorials/intermediate/constrainedlayout_guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ def example_plot(ax, fontsize=12, hide_labels=False):
for pad, ax in zip(pads, axs.flat):
pc = ax.pcolormesh(arr, **pc_kwargs)
fig.colorbar(pc, ax=ax, shrink=0.6, pad=pad)
ax.set_xticklabels('')
ax.set_yticklabels('')
ax.set_xticklabels([])
ax.set_yticklabels([])
ax.set_title(f'pad: {pad}')
fig.set_constrained_layout_pads(w_pad=2 / 72, h_pad=2 / 72, hspace=0.2,
wspace=0.2)
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy