Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Project Status: Unsupported – The project has reached a stable, usable state but the author(s) have ceased all work on it. A new maintainer may be desired. https://img.shields.io/pypi/pyversions/binheat.svg MIT License

GitHub | PyPI | Issues | Changelog

binheat converts a description of a binary relation into a PDF image of the relation as a binary heat map (a.k.a. matrix display, adjacency matrix, comparison chart, and probably a bunch of other names as well; see below for an example).

Each line of the input (except for blank lines and comments, which are ignored) must be of the form x<TAB>y<TAB>z..., denoting pairs (x, y), (x, z), etc. in the binary relation.

In the output table, the values from the first column of each input line become the labels of the table’s rows, and the values from the second input column onwards become the labels of the table’s columns. This can be reversed with the --transpose option.

Installation

binheat requires Python 3.7 or higher. Just use pip for Python 3 (You have pip, right?) to install binheat and its dependencies:

python3 -m pip install binheat

Usage

binheat [<OPTIONS>] [<infile> [<outfile>]]

Input is read from <infile> (defaulting to standard input), and the resulting PDF is written to <outfile> (defaulting to <infile> with its file extension changed to .pdf, or to standard output if <infile> is standard input).

Options

-C FILE, --column-labels FILE

Use the lines in FILE (after discarding blank lines & comments) in the order they appear as column labels (or row labels if --transpose is in effect). Any pairs in the input whose second column does not appear in FILE are discarded.

-F FONT, --font FONT

Typeset text in the given font. FONT must be either the name of a builtin PostScript font or the path to a .ttf file. By default, text is typeset in Times-Roman.

-f SIZE, --font-size SIZE

Set the text size to SIZE (default 12).

-R FILE, --row-labels FILE

Use the lines in FILE (after discarding blank lines & comments) in the order they appear as row labels (or column labels if --transpose is in effect). Any pairs in the input whose first column does not appear in FILE are discarded.

--sort, --no-sort

Whether to list labels in the output in lexical order rather than in the order in which they appear in the input file; default: --no-sort

-T, --transpose

The output will be transposed — i.e., the first column of the input will be used for the output table’s column labels, and the second input column onwards will be used for the table’s row labels.

Example

The following input file:

NUL (\0, 0x00)<TAB>iscntrl
0x01..0x06<TAB>iscntrl
BEL (\a, 0x07)<TAB>iscntrl
BS (\b, 0x08)<TAB>iscntrl
TAB (\t, 0x09)<TAB>iscntrl<TAB>isspace<TAB>isblank
LF (\n, 0x0A)<TAB>iscntrl<TAB>isspace
VT (\v, 0x0B)<TAB>iscntrl<TAB>isspace
FF (\f, 0x0C)<TAB>iscntrl<TAB>isspace
CR (\r, 0x0D)<TAB>iscntrl<TAB>isspace
0x0E..0x1F<TAB>iscntrl
SPACE (0x20)<TAB>isprint<TAB>isspace<TAB>isblank
!"#$%&'()*+,-./<TAB>isprint<TAB>isgraph<TAB>ispunct
0123456789<TAB>isprint<TAB>isgraph<TAB>isalnum<TAB>isdigit<TAB>isxdigit
:;<=>?@<TAB>isprint<TAB>isgraph<TAB>ispunct
ABCDEF<TAB>isprint<TAB>isgraph<TAB>isalnum<TAB>isalpha<TAB>isupper<TAB>isxdigit
GHIJKLMNOPQRSTUVWXYZ<TAB>isprint<TAB>isgraph<TAB>isalnum<TAB>isalpha<TAB>isupper
[\]^_`<TAB>isprint<TAB>isgraph<TAB>ispunct
abcdef<TAB>isprint<TAB>isgraph<TAB>isalnum<TAB>isalpha<TAB>islower<TAB>isxdigit
ghijklmnopqrstuvwxyz<TAB>isprint<TAB>isgraph<TAB>isalnum<TAB>isalpha<TAB>islower
{|}~<TAB>isprint<TAB>isgraph<TAB>ispunct
DEL (0x7F)<TAB>iscntrl

produces (using the default options) an output file that looks like this:

https://github.com/jwodder/binheat/raw/master/examples/ctype.png

Release files for binheat 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for binheat 0.2.2
File Size Uploaded
binheat-0.2.2.tar.gz 131.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for binheat 0.2.2
File Interpreter ABI Platform
binheat-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 138.8 kB

Release files / binheat-0.2.2.tar.gz

Download URL binheat-0.2.2.tar.gz
Size 131.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7020bb94871945ec831ce0a242c3c9de11d34d1c0339b95f2efc3f57df40385f
BLAKE2b-256 checksum
How to use checksums
4ec723e428e446883ecc912df967c99336bf9040391c5413a24ec909baa334bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / binheat-0.2.2-py3-none-any.whl

Download URL binheat-0.2.2-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4d375b409b1cb784cff786f9b7180928d473496cf018cba1803fa7f5ebdf46c
BLAKE2b-256 checksum
How to use checksums
a37065305d7cf8408a82acacdee9b6cc8cc494acc031acfa5f3c0b9361f671f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page