xxxxxxxxxx
import seaborn as sns
tips = sns.load_dataset("tips")
plot = sns.catplot (data=tips,
x="day",
y="tip",
kind='bar',
ci=50,
hue="sex",
palette="Accent", legend=False)
plot.fig.suptitle("Value of Tips Given to Waiters, by Days of the Week and Sex",
fontsize=24, fontdict={"weight": "bold"})
xxxxxxxxxx
#'FacetGrid' object has no attribute 'set_title'
#use plot.fig.suptitle() instead
font = {'family': 'serif',
'color': 'darkred',
'weight': 'normal',
'size': 16,
plot.fig.suptitle('Title',fontsize = 12, fontdict=font)
xxxxxxxxxx
# Add a column of appropriate labels
df_reduced['measure'] = df_reduced['ActualExternal'].replace({0: 'Internal',
1: 'External'}
g = sns.FacetGrid(df_reduced, col="measure", margin_titles=True)
g.map(plt.hist, "ActualDepth", color="steelblue", bins=bins, width=4.5)
# Adjust title and axis labels directly
g.set_titles("{col_name}") # use this argument literally
g.set_axis_labels(x_var="Percentage Depth", y_var="Number of Defects")