Skip to content

Unexpected behavior of horizontal alignment in axis text #927

Closed

Description

@ftvalentini

For example:

from plotnine import ggplot, aes, geom_point, theme, element_text
import pandas as pd

df = pd.DataFrame({'x': [1, 2, 3, 4], 'y': ['AA', 'BBBBBB', 'CC', 'DD']})
p = (
    ggplot(df, aes(x='x', y='y'))
    + geom_point()
    + theme(axis_text_y=element_text(ha="left"), figure_size=(3, 2))
)
p.show()

gives:

Image

The same goes for hjust=0.

I'm sorry but I did not manage to get it to work by using margin either.


Using version 0.14.4, Python 3.12.8

Activity

  1. added a commit that references this issue on Mar 27, 2025
    3a91e3a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions