How to customize titles and y labels in a relplot

Question:

I currently have a seaborn relplot

harker = sns.relplot(data = majorsLong, x = "SiO2", y = "Wt %", palette = colors,
                     markers = marks, style = "Lithology", hue = "Lithology",
                     kind = "scatter", col = "Oxide", col_wrap = 2, s = 150,
                     facet_kws = {'sharey': False, 'sharex': True},
                     linestyle = "None", legend = False)

Which creates this figure.

enter image description here

I want to do two things with this figure. First, I want to remove all of the subplot titles. Second, I want to set each y label (even the interior ones) to be "Oxide" + " Wt %", but can’t figure out how to do either.

Asked By: Imperator

||

Answers:

You can iterate through harker.axes:

for ax in harker.axes.flatten():
    ax.set_title('')
    ax.set_ylabel('Oxide + Wt %')
Answered By: tdy

You can set those directly from you harker FacetGrid object:

harker.set_titles("")
harker.set_ylabels("My Label", clear_inner=False)

You don’t need to iterate through the axes, these methods set them on all facets.

Answered By: ohtotasche
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.