I have a Dataframe which I'm using to create a bar plot.
This is the code that generated the plot.
from matplotlib import pyplot as plt
import pandas as pd
gendercrcard=pd.DataFrame({'Gender':['Female','Female','Male','Male'],'Hascrcard':['No','Yes','No','Yes'],'count':[1351,3192,1594,3863]})
gendercrcard.plot(kind='bar')
plt.title('Credit Card Status with Gender', size = 20)
plt.xticks(size = 15, rotation = 0)
plt.ylabel('Frequency', size = 15)
plt.show()
My xticks
currently correspond to their index in the df
. However, the index number do not provide context.
Is there a way to change them so that they say 'Male/Female' and 'Credit card/No credit card'?
I'd Also like to change the colour of the boxes (e.g. male = blue and female = pink).