visualize_5_32.py 702 B

123456789101112131415
  1. def corr_mat(df="dataframe", corm="pearson", cmap="seismic", r=300, show=False, dim=(6, 5), axtickfontname="Arial",
  2. axtickfontsize=7, ar=90, figtype='png', theme=None):
  3. if theme == 'dark':
  4. general.dark_bg()
  5. d_corr = df.corr(method=corm)
  6. plt.subplots(figsize=dim)
  7. plt.matshow(d_corr, vmin=-1, vmax=1, cmap=cmap)
  8. plt.colorbar()
  9. cols = list(df)
  10. ticks = list(range(0, len(list(df))))
  11. plt.xticks(ticks, cols, fontsize=axtickfontsize, fontname=axtickfontname, rotation=ar)
  12. plt.yticks(ticks, cols, fontsize=axtickfontsize, fontname=axtickfontname)
  13. general.get_figure(show, r, figtype, 'corr_mat', theme)
  14. # for data with pre-calculated mean and SE