Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Continued Text Alignment Issues #1742

Copy link
Copy link
Closed
@pmarshwx

Description

@pmarshwx
Issue body actions

When using AnchoredText, setting the horizontal alignment to 'center' causes the text to be centered around the left-most edge of the text space. In other words, the text is being centered around the location of the the left spine of the text box plus the padding amount.

If you try to right-align the text, the entire text is actually found to the left of the text box.

Here's a simple example and figure to illustrate. Note, this works with or without ImageGrid.

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
from mpl_toolkits.axes_grid.anchored_artists import AnchoredText
fig = plt.figure()
# grid = ImageGrid(fig, 111, nrows_ncols=(1,1))
# ax0 = grid[0]
ax0 = fig.add_subplot(111)
title = 'Test Test Test Test Test'
at = AnchoredText(title, prop=dict(size=24, horizontalalignment='center'),
                  frameon=True, loc=9, borderpad=0.5, pad=0.5)
at.patch.set_boxstyle("round, pad=0, rounding_size=0.25")
ax0.add_artist(at)
plt.show()

tmp

Here are a couple of issues and pull requests that could be related.

Issue #1571
Pull Request #1081
Pull Request #1589

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.