Skip to main content

Binary heat map generator

Project description

Project Status: Active — The project has reached a stable, usable state and is being actively developed. MIT License!-1EAEDB.svg

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.


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

python3 -m pip install binheat


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).


  • -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.


The following input file:

NUL (\0, 0x00)<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
SPACE (0x20)<TAB>isprint<TAB>isspace<TAB>isblank
DEL (0x7F)<TAB>iscntrl

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

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for binheat, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size binheat-0.2.0-py3-none-any.whl (7.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size binheat-0.2.0.tar.gz (130.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page