Label axes on Seaborn Barplot

I’m trying to use my own labels for a Seaborn barplot with the following code: import pandas as pd import seaborn as sns fake = pd.DataFrame({‘cat’: [‘red’, ‘green’, ‘blue’], ‘val’: [1, 2, 3]}) fig = sns.barplot(x = ‘val’, y = ‘cat’, data = fake, color=”black”) fig.set_axis_labels(‘Colors’, ‘Values’) However, I get an error that: AttributeError: ‘AxesSubplot’ … Read more

Rotate label text in seaborn factorplot

I have a simple factorplot import seaborn as sns g = sns.factorplot(“name”, “miss_ratio”, “policy”, dodge=.2, linestyles=[“none”, “none”, “none”, “none”], data=df[df[“level”] == 2]) The problem is that the x labels all run together, making them unreadable. How do you rotate the text so that the labels are readable? 10 Answers 10

How to save a Seaborn plot into a file

I tried the following code (test_seaborn.py): import matplotlib matplotlib.use(‘Agg’) import matplotlib.pyplot as plt matplotlib.style.use(‘ggplot’) import seaborn as sns sns.set() df = sns.load_dataset(‘iris’) sns_plot = sns.pairplot(df, hue=”species”, size=2.5) fig = sns_plot.get_figure() fig.savefig(“output.png”) #sns.plt.show() But I get this error: Traceback (most recent call last): File “test_searborn.py”, line 11, in <module> fig = sns_plot.get_figure() AttributeError: ‘PairGrid’ object has … Read more