betterspy

Show sparsity patterns of sparse matrices


Keywords
mathematics, matrix, pypi, python, sparse-matrices, sparse-matrix, visualization
License
CNRI-Python-GPL-Compatible
Install
pip install betterspy==0.1.5

Documentation

betterspy

PyPi Version PyPI pyversions GitHub stars PyPi downloads

Discord

gh-actions codecov LGTM Code style: black

Show sparsity patterns of sparse matrices or write them to image files.

Example:

import betterspy
from scipy import sparse

A = sparse.rand(20, 20, density=0.1)

# betterspy.plot()
# set attributes on gca()
# plt.show()
# or directly

betterspy.show(A)

betterspy.write_png(
    "out.png",
    A,
    # border_width=2,
    # border_color="red",
    # colormap="viridis"
)
no colormap viridis

There is a command-line tool that can be used to show matrix-market files:

betterspy msc00726.mtx [out.png]

See betterspy -h for all options.

Installation

betterspy is available from the Python Package Index, so simply do

pip install betterspy

to install.

License

This software is published under the GPLv3 license.