plotnine icon indicating copy to clipboard operation
plotnine copied to clipboard

Horizontal alignment of facet title not working

Open jwhendy opened this issue 1 year ago • 11 comments

I think I ran into the same as #506 . Repro:

import pandas as pd
from plotnine import *

df = pd.DataFrame({'x': [0, 1, 2, 3], 'y': [4, 5, 6, 7], 'facet': ['a', 'a', 'b', 'b']})
p = ggplot(df, aes(x='x', y='y')) + geom_point() + facet_wrap('~facet')
p

Default facet strip_text: image

Theming element_text to try and apply ha='right', I get the same result:

p + theme(strip_text=element_text(ha='right'))
image

Using ha='left' yields the same:

p + theme(strip_text=element_text(ha='left'))
image

I also tried explicitly using strip_text_x (and strip_text_y, cause why not try it all) and saw no effect. I also tried facet_grid instead of facet_wrap just to be thorough and saw the same behavior as above.

I'm on OS X, with plotnine==0.13.6. I was on 0.13.0 when I wrote this, upgraded, restarted my jupyter kernel, and reproduced again to verify it's not been fixed, at least in the released version.

jwhendy avatar Sep 01 '24 23:09 jwhendy