Skip to content

axis offset texts not moving when tick & labels are displaced using rcParams or Axes.tick_params #19471

Open
@anntzer

Description

@anntzer

Bug report

Bug summary

Moving ticks and labels to the top and right axis using rcParams or Axes.tick_params() doesn't move the offset text as well.

Code for reproduction

from pylab import *
rcdefaults()

rcParams.update({
    "xtick.top": 1, "xtick.labeltop": 1, "xtick.bottom": 0, "xtick.labelbottom": 0,
    "ytick.right": 1, "ytick.labelright": 1, "ytick.left": 0, "ytick.labelleft": 0,})
figure().add_subplot().set(xlim=(10001, 10002), ylim=(10001, 10002))
savefig("/tmp/rc.png")

rcdefaults()
figure().add_subplot().set(xlim=(10001, 10002), ylim=(10001, 10002))
gca().tick_params(top=True, labeltop=True, bottom=False, labelbottom=False,
                  right=True, labelright=True, left=False, labelleft=False)
savefig("/tmp/tickparams.png")

rcdefaults()
figure().add_subplot().set(xlim=(10001, 10002), ylim=(10001, 10002))
gca().xaxis.tick_top()
gca().yaxis.tick_right()
savefig("/tmp/tick_dir.png")

Actual outcome

Positioning via rcParams:
rc
via Axes.tick_params():
tickparams
via XAxis.tick_top()/YAxis.tick_right():
tick_dir

Only the latest approach works. (The offset texts are overlapping, but that's another issue...)

Expected outcome

Same as XAxis.tick_top()/YAxis.tick_right()

Matplotlib version

  • Operating system: linux
  • Matplotlib version (import matplotlib; print(matplotlib.__version__)): HEAD
  • Matplotlib backend (print(matplotlib.get_backend())): agg
  • Python version: 39
  • Jupyter version (if applicable):
  • Other libraries:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions