File: np_matrix.py

package info (click to toggle)
vedo 2025.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,404 kB
  • sloc: python: 64,792; javascript: 1,932; xml: 437; sh: 139; makefile: 6
file content (22 lines) | stat: -rw-r--r-- 556 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Visualize a n:dotm numpy matrix"""
from vedo.pyplot import matrix
from vedo import show
import numpy as np

n, m = (6, 5)
M = np.eye(n, m)/2 + np.random.randn(n, m)*0.1
# print(M)

mat = matrix(
    M,
    cmap='Reds',
    title='My numpy Matrix',
    xtitle='Genes of group A',
    ytitle='Genes of group B',
    xlabels=[f'hox{i}' for i in range(m)],
    ylabels=[f'bmp{i}' for i in range(n)],
    scale=0.15,  # size of bin labels; set it to 0 to remove labels
    lw=2,        # separator line width
)

show(mat, __doc__, bg='k7', zoom=1.2).close()