Skip to content

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

@TerryGamon

Description

@TerryGamon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions