0

I am trying to plot a bar chart on a FacetGrid using seaborn library. But I am having trouble adding string labels to the chart below.

For instance, the Gender variable has two values, 0 and 1. However, instead using integer values, I want to label these values as "Male" and "Female", respectively at this chart. How can I do that?

import seaborn as sbn    
grid = sbn.FacetGrid(df_train, row='Gender', col='Loan_Status', size=2.2, aspect=1.6)
grid.map(sbn.barplot, 'Married', 'ApplicantIncome', alpha=.5, ci=None)
grid.add_legend()

Bar chart

ImportanceOfBeingErnest
  • 321,279
  • 53
  • 665
  • 712
imran
  • 1
  • 1
    The easiest option would be to rename them in your dataframe. – ImportanceOfBeingErnest Dec 23 '17 at 13:39
  • Thanks for your comment. I thought about that. But I think there should be a easier way without editing the data frame. – imran Dec 23 '17 at 13:47
  • Well, using an dataframe with the updated Data would be one line of code. Changing all titles manually would not be possible in a single line, so "easy" is pretty much depending on the point of view. In any case, since it seems you want to go the second road, I marked as duplicate of an existing question on exactly this subject. – ImportanceOfBeingErnest Dec 23 '17 at 13:57

0 Answers0