has2k1 / plotnine

A Grammar of Graphics for Python
https://plotnine.org
MIT License
4k stars 213 forks source link

Using adjust_text with color aesthetic produces strange result #624

Closed sixersfanhal closed 2 years ago

sixersfanhal commented 2 years ago

Using plotnine==0.8.0, when I run

from plotnine import *
from plotnine.data import mtcars

(ggplot(mtcars.head(15), aes(x='wt', y='mpg'))
    + geom_point()
    + geom_text(aes(label='name'), adjust_text={'arrowprops': {'arrowstyle': '-'}}))

I get the following, which looks good plotnine_test_good

But if I add a color aesthetic I get something odd:

(ggplot(mtcars.head(15), aes(x='wt', y='mpg', color='factor(gear)'))
    + geom_point()
    + geom_text(aes(label='name'), adjust_text={'arrowprops': {'arrowstyle': '-'}}))

plotnine_test_bad

Any ideas? Thank you so much for this package, it's been extremely helpful.

has2k1 commented 2 years ago

Working with adjust_text was made a little more robust in v0.9.0. This behaviour does not show up!

sixersfanhal commented 2 years ago

Ahh awesome thank you!