0

Lower Matrix Please can you help me to understand why my 2D matrix correlation plot has parts chopped off the top and the bottom.

funky corner of matrix top left

funky corner of matrix bottom left

data1 = {'basic_cotton_ultra': [-1779046585, -1745487915, -1745369611, -1753758211, -1753790979, -1753916035, -1758110339, -1753776833, -1754176225, -1779337953, -1779337953, -1796083425, -1795958913, -1661806721, -1107830785, -1108017153, -1082857513, -1082857515, -1082666537, -1082699265, -1082699281, -1116269057, -1117448705, -1653136257, -1653119873, -1644989089, -1645128417, -1645185761, -1661864673, -1661731041, -1644691681, -1611143331, -1619663011, -1636445347, -1636318243, -1627926019, -1611278867, -1619730963, -1623949841, -1623888513, -1625916065, -1655220898, -1655615138],

'celosia_velvet': [-194646179, -194904257, -1268529857, -1267481313, -1250822825, -1208752313, -1225529513, -1225694361, -1234144793, -1234173465, -1216936713, -143180577, -168346147, -50914817, -51176481, -588169249, -588224545, -596577313, -596520097, -579741929, -546244841, -537860265, -554637481, -554506905, -554512153, -697057049, -680312579, -713829155, -713822883, -730600611, -731776387, -194904449, -194972065, -194783457, -193740513, -176962273, -143403233, -160301257, -697176265, -697047753, -160214985, -159956865, -159956739],

'woven_wallpaper': [-1757944449, -1754017481, -1754017515, -1779175147, -1779043531, -1779042771, -1779042771, -1787437443, -1787298211, -1753743393, -1216487969, -1208099362, -1208101634, -1208617730, -1217006338, -1217006338, -1753747330, -1754009569, -1787596515, -1787727555, -1796116164, -1796114644, -1778942356, -1778950531, -1787330859, -1753219385, -1753227306, -1753360938, -1753360898, -1744833058, -1753745954, -1753877122, -1753947778, -1754140353, -1754050275, -1644990083, -1645120131, -1663993988, -1663598723, -1671995683, -1655218467, -1653080097, -1619003425]}

 data = pd.DataFrame(data1, columns = ["basic_cotton_ultra","celosia_velvet","chiffon","cotton_poplin_ultra","cotton_spandex_jersey","cotton_twill","cyress_cotton_canvas","eco-cotton","fleece","kona_cotton_ultra","lightweight_cotton_twill","linen_cotton_canvas_ultra","long_leaf_sateen_grand","milky","modern_jersey","organic_cotton_knit_ultra","organic_cotton_sateen_ultra","perennial_green_grand","performance_pique","poly_crepe_de_chine","sateen","silkyfaile","sport_lycra","woven_wallpaper",])

 corr = data.corr()
 fig = plt.figure(figsize=(18,18))
 ax = fig.add_subplot(111)
 cax = ax.matshow(corr, cmap='coolwarm', vmin=-1, vmax=1)
 fig.colorbar(cax)
 ticks = np.arange(0,len(data.columns),1)
 ax.set_xticks(ticks)
 plt.xticks(rotation=90)
 ax.set_yticks(ticks)
 ax.set_xticklabels(data.columns)
 ax.set_yticklabels(data.columns)
 #plt.title("Correlation Matrix")
 plt.savefig('Correlation_Matrix.png')
 plt.show()

All squares should be of equal size. Basic cotton ultra is a red rectangle and woven wallpaper is the grey rectangle.

Thanks in advance

Top of Matrix after using ax.get_ylim()

Krackle
  • 363
  • 1
  • 3
  • 9
  • I think this is the same as your issue https://stackoverflow.com/q/56942670/7746385 – gereleth Sep 22 '19 at 11:14
  • Would you mind taking another look please as the suggestion unfortunately did not work. – Krackle Sep 23 '19 at 01:57
  • Riddle Me This - I asked my mate to load my file on to her laptop and the plot aligned fine, but the same file on mine does not. We used the same file the only difference is I have a MacPro 15 and she has MacPro13. Why is this happening? – Krackle Sep 28 '19 at 20:41

0 Answers0