ha="right" breaks AnchoredText placement. · Issue #18363 · matplotlib/matplotlib · GitHub
Skip to content

ha="right" breaks AnchoredText placement. #18363

Description

@janosh

Bug report

Bug summary

Setting ha="right" through the prop kwarg breaks AnchoredText placement.

Code for reproduction

import matplotlib.pyplot as plt
from matplotlib.offsetbox import AnchoredText

prop = {"ha": "right", "bbox": {"lw": 0.5, "facecolor": "white"}}
text_box = AnchoredText("test\ntest long text for ha", prop=prop, loc="upper right", pad=0.2)
plt.gca().add_artist(text_box)

Actual outcome

bug

Expected outcome

I was expecting the text box to end up in the same place it does when not setting ha="right":

normal

Matplotlib version

  • Operating system: macOS 10.15.6
  • Matplotlib version: 3.2.1 (pip-installed)
  • Matplotlib backend: module://ipykernel.pylab.backend_inline
  • Python version: 3.6.10

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions