matviz

raw JSON →
1.0.6 verified Fri May 01 auth: no python

matviz provides simple matrix data visualization tools built on matplotlib and numpy. Current version 1.0.6 supports Python >=3.10. Development appears intermittent with no recent releases since v1.0.0 (July 2023).

pip install matviz
error AttributeError: module 'matviz' has no attribute 'plot_matrix'
cause Using 'import matviz' and then 'matviz.plot_matrix()' instead of direct import.
fix
Use 'from matviz import plot_matrix' and then 'plot_matrix(data)'.
error ValueError: could not broadcast input array from shape (n,m) into shape (n,)
cause Passing a 2D array but with incompatible dimensions for the selected color mapping or axis.
fix
Ensure input is a 2D numpy array of shape (rows, cols). Use np.array(data).reshape(rows, cols) if needed.
gotcha plot_matrix returns a figure and axes tuple, not just a figure. Unpack with fig, ax = plot_matrix(...) to avoid AttributeError.
fix Use fig, ax = plot_matrix(data) instead of fig = plot_matrix(data).
gotcha The library relies on matplotlib's interactive backend. If running in a headless environment, set matplotlib backend to 'Agg' before importing matviz.
fix import matplotlib; matplotlib.use('Agg') before import matviz.
deprecated Functions like heatmap and correlation_plot from early versions (pre-1.0.0) are deprecated. Use plot_matrix instead.
fix Upgrade to 1.0.0+ and use plot_matrix.

Create a basic matrix heatmap with matviz.

import numpy as np
from matviz import plot_matrix

data = np.random.rand(5,5)
fig, ax = plot_matrix(data, title='My Matrix')
import matplotlib.pyplot as plt
plt.show()