I am trying to use matplotlib to graph the distribution of salary grouped by region, with the y-axis showing the % of people having that salary.
So far I have been able to come up with:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
records = pd.DataFrame({'Name': ['John','Rachel','Tom','Stan','Jack','Ben','Joe','Juliet','Nigel','Veronica','Cam'],
'salary': [40104,29401,57383,38494,99302,44733,40242,49555,13934,44011,88920],
'Country': ['USA', 'USA', 'USA', 'France', 'France', 'France', 'China', 'China', 'Japan', 'Japan', 'France'],
'Region': ['America', 'America', 'America', 'Europe', 'Europe', 'Europe', 'Asia','Asia','Asia','Asia','Europe']})
recordsgraph = records.pivot(columns='Region',values='salary')
recordsgraph.plot.density()
But I want the y-axis to show the percentage of the population for each region that has that salary. Any ideas on how to accomplish that?