Skip to content

BUG: seaborn.axisgrid.FacetGrid.set_xticklabels(rotation=70) makes x-ticks disappear #3341

@Demetrio92

Description

@Demetrio92

Overview

Setting rotation of tick labels on a grid coming from an sns.catplot makes them disappear. Must be a combination of factors. Reproducible example below.

Reproducible Example:

import seaborn as sns

df = sns.load_dataset("penguins")

grid = sns.catplot(
    data=df,
    x='species',
    y='body_mass_g',
    row='island',
    hue='species',
    capsize=0.2,
    kind='bar',
    errorbar='pi',
    dodge=False,
    sharey=True,
    sharex=True,
)
# grid.figure.tight_layout()  # does not help
grid.set_xticklabels(rotation=70)  # turn off to see labels appear again
# grid.figure.tight_layout()  # does not help
grid.add_legend(title='species')
grid.figure.show()

Result without Rotation

image

BUG: Result with Rotation

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions