Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Legend now always in 2 rows (text is below and not right to symbol) when using theme(legend_position='bottom') #761

Closed
TerryGamon opened this issue Mar 22, 2024 · 0 comments
Labels

Comments

@TerryGamon
Copy link

The Legend is now in 2 Rows (text is below and not right to symbol) when using
plotnine.theme(legend_position='bottom')
even whentrying to change number of rows to one.

Is this intended?
Couldn't find anything regarding this in changelog.

import pandas as pd
import numpy as np
import plotnine
np.random.seed(42)
data = {
    'Alphanumeric': ['A1', 'B2', 'C3', 'D4', 'E5'],
    'RandomInt1': np.random.randint(0, 100, size=5),
    'RandomInt2': np.random.randint(0, 100, size=5)
}
df = pd.DataFrame(data)

(plotnine.ggplot(df)
 +plotnine.geom_point(plotnine.aes(x='RandomInt1',y='RandomInt2', color='Alphanumeric'))
 +plotnine.theme(legend_position='bottom')
 +plotnine.guides(color=plotnine.guide_legend(nrow=1))
 )

image

@has2k1 has2k1 added the bug label Mar 26, 2024
@has2k1 has2k1 closed this as completed in 4c5c5be Mar 27, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants