Arnold Klein
Arnold Klein

Reputation: 3086

Transpose factorplot in seaborn

Following my previous question how to draw several box plots, now I am wondering how transpose the factor plot and instead of having 1x5 pictures

enter image description here

I need to get it as 5x1.

How to vertically align the factorplot?

Upvotes: 0

Views: 1307

Answers (1)

ImportanceOfBeingErnest
ImportanceOfBeingErnest

Reputation: 339570

For a seaborn boxplot you need to use the row argument to supply the quantity to map along the rows, instead of the col argument.

import seaborn as sns
import matplotlib.pyplot as plt

titanic = sns.load_dataset("titanic")

g = sns.factorplot(y="age", x="embark_town",
                    hue="sex", row="class",
                    data=titanic[titanic.embark_town.notnull()],
                   orient="v", kind="box", size=3)
plt.show()

enter image description here

Upvotes: 2

Related Questions