image_output_3.png image_output_2.png image_output_1.png
import seaborn as sns

def plotDistribution(data, metric):
    """ Plot distributions """
    sns.set_style('whitegrid')
    distributionTwo = sns.FacetGrid(data, hue='RegionName', aspect=2.5)
    distributionTwo.map(sns.kdeplot, metric, shade=True)
    distributionTwo.set(xlim=(100000, 550000))
    distributionTwo.add_legend()
    distributionTwo.set_axis_labels(str(metric), 'Proportion')
    distributionTwo.fig.suptitle(str(metric) + ' vs Region (2016)')
plotDistribution(newdf2, 'MedianListingPrice_SingleFamilyResidence')
plotDistribution(newdf2, 'MedianSoldPrice_AllHomes')