I tried to format the row and column title labels only with their names like so:
g.set_titles( row_template="{row_name}", col_template="{col_name}",size = 15 )
It works for the columns but not for the column labels (on the right), both my template and the original row_var=row_name is shown overlayed.
That's not too surprising, margin_titles is just a bit of a hack that draws text on the figure in the right place, so it won't overwrite the old text.
As a workaround, you could call plt.setp(f.texts, text="") first to clear it.
Thanks for your quick reply, but your workaround does not seem to work - I'm probably doing something wrong. I use this snippet:
sns.set(style="white")
f = plt.figure()
plt.setp(f.texts, text="")
g = sns.FacetGrid( twigdistances, row='dataset', col='neurontype', margin_titles = True)
g.map(sns.distplot, u'distance_from_twig_root', kde=False, hist=True, norm_hist=False,hist_kws={"alpha":1.0})
g.set_axis_labels("Input density per twig", "Count");
g.set_titles( row_template="{row_name}", col_template="{col_name}",size = 15 )
Sorry, I just figured it out myself:
plt.setp(g.fig.texts, text="")
And yeah, thanks for writing this library - it is really a pleasure to see my data plotted so nicely in seaborn! Keep going!
Oops yep, sorry about that.
For reference, I just double checked that this works:
tips = sns.load_dataset("tips")
g = sns.FacetGrid(tips, col="sex", row="smoker", margin_titles=True)
g.map(sns.plt.scatter, "total_bill", "tip")
plt.setp(g.fig.texts, text="")
g.set_titles(row_template="{row_name}", col_template="{col_name}")
Revised hack from #706:
tips = sns.load_dataset("tips")
g = sns.FacetGrid(tips, col="sex", row="smoker", margin_titles=True)
g.map(sns.plt.scatter, "total_bill", "tip")
for ax in g.axes.flat:
plt.setp(ax.texts, text="")
g.set_titles(row_template="{row_name}", col_template="{col_name}")
Most helpful comment
Revised hack from #706: