Betterspy
:eyes: Visualization for SciPy sparse matrices.
Install / Use
/learn @nschloe/BetterspyREADME
betterspy
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"
)
<img src="https://nschloe.github.io/betterspy/plain.png"> | <img src="https://nschloe.github.io/betterspy/viridis.png"> :-------------------:|:------------------:| no colormap | viridis |
There is a command-line tool that can be used to show matrix-market or Harwell-Boeing files:
betterspy msc00726.mtx [out.png]
See betterspy -h for all options.
Gallery
<img src="https://nschloe.github.io/betterspy/bp_200.mtx.png" width="70%"> | <img src="https://nschloe.github.io/betterspy/bp_600.mtx.png" width="70%"> | <img src="https://nschloe.github.io/betterspy/Chebyshev2.mtx.png" width="70%">
:---------:|:------------:|:---------------:|
bp_200 | bp_600 | Chebyshev2 |
<img src="https://nschloe.github.io/betterspy/orani678.mtx.png" width="70%"> | <img src="https://nschloe.github.io/betterspy/rajat19.mtx.png" width="70%"> | <img src="https://nschloe.github.io/betterspy/rdb1250l.mtx.png" width="70%">
:---------:|:------------:|:---------------:|
orani678 | rajat19 | rdb1250l |
<img src="https://nschloe.github.io/betterspy/rdb3200l.mtx.png" width="70%"> | <img src="https://nschloe.github.io/betterspy/west0989.mtx.png" width="70%"> | <img src="https://nschloe.github.io/betterspy/west1505.mtx.png" width="70%">
:---------:|:------------:|:---------------:|
rdb3200l | west0989 | west1505 |
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.
Related Skills
node-connect
336.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
82.8kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
82.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
336.2kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
