np_matrix.py 556 B

12345678910111213141516171819202122
  1. """Visualize a n:dotm numpy matrix"""
  2. from vedo.pyplot import matrix
  3. from vedo import show
  4. import numpy as np
  5. n, m = (6, 5)
  6. M = np.eye(n, m)/2 + np.random.randn(n, m)*0.1
  7. # print(M)
  8. mat = matrix(
  9. M,
  10. cmap='Reds',
  11. title='My numpy Matrix',
  12. xtitle='Genes of group A',
  13. ytitle='Genes of group B',
  14. xlabels=[f'hox{i}' for i in range(m)],
  15. ylabels=[f'bmp{i}' for i in range(n)],
  16. scale=0.15, # size of bin labels; set it to 0 to remove labels
  17. lw=2, # separator line width
  18. )
  19. show(mat, __doc__, bg='k7', zoom=1.2).close()