Skip to content

label1On set to true when axis.tick_params(axis='both', which='major', length=5) #13223

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

Closed
dertz opened this issue Jan 19, 2019 · 3 comments
Closed
Milestone

Comments

@dertz
Copy link

dertz commented Jan 19, 2019

Bug report

Bug summary

I have more than 10 majorTicks on the X-axis. label1On is False for each of the odd numbered majorTicks. Call tick_params as shown in subject and label1On is True for all MajorTick members after return.

Code for reproduction

major_ticks = axis.xaxis.get_major_ticks()
    if len(major_ticks) > 10:
        for i, tick in enumerate(major_ticks):
            if (i % 2) == 1:
                tick.label1On = False
logger.info("the value  of label1O is %r", axis.xaxis.majorTicks[1].label1On)
axis.tick_params(axis='both', which='major', length=5)
logger.info("the value  of label1O is %r", axis.xaxis.majorTicks[1].label1On)

Actual outcome

2019-01-18 16:42:28,509 - unavco.plotter.posfile - INFO - the value  of label1O is False
2019-01-18 16:42:36,626 - unavco.plotter.posfile - INFO - the value  of label1O is True

Expected outcome

I expected the value of label1On to not change.
Use to work with version 1.2.0 and python 2.7

Matplotlib version

  • Operating system: Mac OS High Sierra
  • Matplotlib version: 3.0.2
  • Matplotlib backend (print(matplotlib.get_backend())): MacOSX
  • Python version: 3.7
  • Jupyter version (if applicable):
  • Other libraries:

yum install after install python 3.6

@timhoffm
Copy link
Member

Can you please provide a full minimal example?

@anntzer
Copy link
Contributor

anntzer commented Jan 31, 2019

label1On is deprecated since #10088; however, the equivalent code using set_visible and get_visible works without suffering from the same issue, as of master.

from pylab import *
ax = gca()
major_ticks = ax.xaxis.get_major_ticks()
for i, tick in enumerate(major_ticks):
    if i % 2 == 1:
        tick.set_visible(False)
print(ax.xaxis.majorTicks[1].get_visible())
ax.tick_params(axis='both', which='major', length=5)
print(ax.xaxis.majorTicks[1].get_visible())
plt.show()

@anntzer
Copy link
Contributor

anntzer commented Feb 7, 2019

I am going to close this as fixed in master (per the above -- the mechanism is different now), and milestone as 3.0.x in case someone really wants to put in a separate fix for that branch.

@anntzer anntzer closed this as completed Feb 7, 2019
@anntzer anntzer added this to the v3.0.3 milestone Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants