8000 Tick.apply_tickdir has no effect · Issue #19051 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Tick.apply_tickdir has no effect #19051
Closed
@anntzer

Description

@anntzer

Bug report

Bug summary

Calling Tick.apply_tickdir does not update the tick's direction.

Code for reproduction

fig, ax = plt.subplots()
fig.canvas.draw()  # ensure ticks are updated
ax.xaxis.majorTicks[1].apply_tickdir("inout")
plt.show()

Actual outcome

Last line has no effect.

Expected outcome

2nd major x tick should be "inout".

This has actually likely never worked (at least as far back as mpl2.0), because Tick.apply_tickdir updates _tickmarkers but these only get applied to the actual Line2D object used to draw ticks in Tick._apply_params. So really apply_tickdirs should be considered a private helper for Tick._apply_params (which calls apply_tickdirs, and then applies the new _tickmarks to the Line2Ds), which is itself a helper for the public Axis.set_tick_params`.

So the solution is either to make Tick.apply_tickdir private, or possibly turn it into a public Tick.set_tickdir (following standard naming) which does actually update the Line2D.

Matplotlib version

  • Operating system: fedora
  • Matplotlib version: master
  • Matplotlib backend (print(matplotlib.get_backend())): any
  • Python version: 38
  • Jupyter version (if applicable):
  • Other libraries:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0