I am a newbie to data science. I have a very basic understanding of Seaborn. My understanding is that it is used to plot grids. That said, I intend to have a better understanding of 'FacetGrid' and the term 'facet'.

FacetGrid is a multi-plot grid for plotting conditional relationships. FacetGrid object takes a DataFrame as input and the names of the variables that will form the row, column, or hue dimensions of the grid. The variables should be categorical and the data at each level of the variable will be used for a facet along that axis.

The confusion is in the line 'the data at each level of the variable will be used for a facet along that axis'. Here, what does it mean by facet?

I am adding a code example where FacetGrid is used(Here FacetGrid is used to plot a 2D scatter plot):

sns.FacetGrid(haberman, hue ='Survival Status', size = 8) \
.map(plt.scatter, 'Age of Patient', 'Positive Axillary Nodes') \

Can someone give a better explanation for a better understanding?


According to the facetGrid documentation :

This class maps a dataset onto multiple axes arrayed in a grid of rows and columns that correspond to levels of variables in the dataset. The plots it produces are often called “lattice”, “trellis”, or “small-multiple” graphics.

Here levels mean  « categories ». The main goal is to not display the full set of data, but multiple subsets of data that fit conditions on categorical variables.

Definition of facet found here :

facet : a particular aspect or feature of something.

In the following example, the vertical axis (column of graphs) represents the facet/feature/attribute Smoker/Not-Smoker and the horizontal axis (line of graphs) represents the attribute Time. So each graph is the conditional AND between the two attributes :

  • Smoker AND Lunch
  • Smoker AND Dinner
  • Not Smoker AND Lunch
  • Not Smoker AND Dinner


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.