Part 2 - Plotting Using Seaborn - Distribution Plot, Facet Grid

  23 Aug 2019
  python, visualisation

Introduction and Data preparation

Please follow the folloing links regarding data preparation and previous posts to follow along -


Subset of data based on complexity

test_scores_easy = test_scores[test_scores['Complexity']=='Easy']
test_scores_medium = test_scores[test_scores['Complexity']=='Medium']
test_scores_hard = test_scores[test_scores['Complexity']=='Difficult']

Distribution of score percentage across track in test with easy complexity

sns.set(style="whitegrid")
g = sns.FacetGrid(test_scores_easy, col='Track', row='Test Name', height = 4, aspect =2.5)
g.map(sns.distplot, "Percent", kde = False, hist = True, rug = False)
g.set_titles(size =20)
g.set_xlabels(size = 25)
g.set_ylabels(size = 25, label = "Participants")
g.set_yticklabels(fontsize =25)
g.set_xticklabels(fontsize =25, labels = [0,0,20,40,60,80,100])
g.fig.suptitle('Distribution of score percentage across track in test with easy complexity', fontsize=40, x = 0.5, y = 1.05)
#plb.savefig('Distribution_easy.png',dpi=50,bbox_inches='tight')

Distribution Plot


Distribution of score percentage across track in test with medium complexity

sns.set(style="whitegrid")
g = sns.FacetGrid(test_scores_medium, col='Track', row='Test Name', height = 4, aspect =2.5)
g.map(sns.distplot, "Percent", kde = False, hist = True, rug = False)
g.set_titles(size =20)
g.set_xlabels(size = 25)
g.set_ylabels(size = 25, label = "Participants")
g.set_yticklabels(fontsize =25)
g.set_xticklabels(fontsize =25, labels = [0,0,20,40,60,80,100])
g.fig.suptitle('Distribution of score percentage across track in test with medium complexity', fontsize=40, x = 0.5, y = 1.05)
#plb.savefig('Distribution_medium.png',dpi=50,bbox_inches='tight')

Distribution Plot


Distribution of score percentage across track in test with difficult complexity

sns.set(style = "whitegrid")
g = sns.FacetGrid(test_scores_hard, col='Track', row='Test Name', height = 4, aspect =2.5)
g.map(sns.distplot, "Percent", kde = False, hist = True, rug = False)
g.set_titles(size =20)
g.set_xlabels(size = 25)
g.set_ylabels(size = 25, label = "Participants")
g.set_yticklabels(fontsize =25)
g.set_xticklabels(fontsize =25, labels = [0,0,20,40,60,80,100])
g.fig.suptitle('Distribution of score percentage across track in test with difficult complexity', fontsize=40, x = 0.5, y = 1.05)
#plb.savefig('Distribution_hard',dpi=50,bbox_inches='tight')

Distribution Plot


Jupyter Notebook Link - Part 2 - Plotting Using Seaborn - Distribution Plot, Facet Grid