Seaborn FacetGrid, how to show y tick labels in all subplots

Viewed 2039

In a Seaborn FacetGrid, how can I get the y-axis tick labels to show up in all the subplots, regardless of whether or not sharey=True?

tips = sns.load_dataset("tips")
g = sns.FacetGrid(tips, col="time",  row="sex")
g.map(sns.scatterplot, "total_bill", "tip")

enter image description here

The following attempt returns the error AttributeError: 'FacetGrid' object has no attribute 'flatten'

for axis in g.flatten():
    for tick in axis.get_yticklabels():
        tick.set_visible(True)
2 Answers
for axis in g.axes.flat:
    axis.tick_params(labelleft=True)

This here worked for me.

for axis in axes.flatten():
    for tick in axis.get_yticklabels():
        tick.set_visible(True)

Try looping through each axis of each plot and manually forcing the tick labels to be visible.

Related