Skip to content
Advertisement

Python, Seaborn FacetGrid change titles

I am trying to create a FacetGrid in Seaborn

My code is currently:

JavaScript

This gives my the Figure

My FacetGrid

Now, instead of “ActualExternal =0.0” and “ActualExternal =1.0” I would like the titles “Internal” and “External”

And, instead of “ActualDepth” I would like the xlabel to say “Percentage Depth”

Finally, I would like to add a ylabel of “Number of Defects”.

I’ve tried Googling and have tried a few things but so far no success. Please can you help me?

Thanks

Advertisement

Answer

You can access the axes of a FacetGrid (g = sns.FacetGrid(...)) via g.axes. With that you are free to use any matplotlib method you like to tweak the plot.

Change titles:

JavaScript

Change labels:

JavaScript

Note that I prefer those above the FacetGrid‘s internal g.set_axis_labels and set_titles methods, because it makes it more obvious which axes is to be labelled.

Advertisement