8000 Toggling visibility of axis tick labels causes their destruction · Issue #16197 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Toggling visibility of axis tick labels causes their destruction #16197
Open
@TheAngulion

Description

@TheAngulion

Toggling the visibility of the axis tick labels via set_visible(False) can lead to their outright destruction, see here. According to @ImportanceOfBeingErnest, this issue is related to #10088.

I include a minimal code fragment that demonstrates the problem.

Code for reproduction

from matplotlib import pyplot as plt
plt.plot([0, 1], [8, 6])
ax = plt.gca()
yticks = ax.get_yticklabels()
print(yticks)
for tick in yticks:
    tick.set_visible(False)

print(ax.get_yticklabels())

Actual outcome

<a list of 11 Text yticklabel objects>
<a list of 0 Text yticklabel objects>

Expected outcome

The snippet shows that the y tick labels are destructed after setting their visibility to False. One can restore them by issuing:

ax.yaxis.set_tick_params(labelleft=True)

This issue first occurred on matplotlib 3.1.2 but not on the previous version (which I believe was 3.0.x).

Matplotlib version

  • Operating system: Win10 Pro 64bit
  • Matplotlib version: 3.1.2
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.6.3

Python was installed via WinPython; Matplotlib was manually upgraded to v3.1.2.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0