Skip to main content

The aclustermap package takes a YAMLized pandas DataFrame as input, with optional formatting keywords, and outputs a Seaborn clustermap .png image:

cat example.yaml | aclustermap > example.png

If YAMLizing a pandas DataFrame is a new concept, here is a quick tutorial.

Let's create a Python module generate_example.py

import pandas, yaml;

# Generate random data with make_blobs to yield interesting clustering behavior
from sklearn.datasets import make_blobs; 
example = pandas.DataFrame(make_blobs(n_samples=36, centers=3, n_features=10)[0])

# Convert the DataFrame to a dict
df_dict = example.to_dict()

# Convert the dataframe to a dict, then YAMLize the dict
yml = yaml.dump(df_dict)

# Print to stdout
print(yml)

Here is a one-liner that combines the previous code to generate this dataframe, safe it to a file, and then output it as a clustermap to example.png:

python generate_example.py > example.yaml
cat example.yaml | aclustermap > example.png

Saving the dataframe to a file is not necessary, as it can be piped directly to aclustermap:

python generate_example.py | aclustermap > example.png

aclustermap uses the simplest possible way to tweak the visualization, which is to pass a second YAML dict containing keyword argumnets for seaborn.clustermap and see also, seaborn.set_context, pyplot.setp with the Artist being the clustermap's xticklabels or yticklabels, or pyplot.rcParams.

The formatting must be enclosed in a dict labeled according to the function it applies to. Here is the default formatting, which will be used if no formatting is specified. Otherwise, simply cat a YAMLized nested dictionary with a structure similar to the following.

format:
  seaborn:
    clustermap:
      cmap: CET_CBL1
      annot: true
    set_context:
      context: notebook
  pyplot:
    setp:
      xticklabels:
        rotation: 0
      yticklabels:
        rotation: 0
    rcParams:
      font.size: 12

A convenient way to specify minor formatting tweaks directly at the command line is with a HereDoc:

(python generate_example.py; cat <<EOF) | python -m aclustermap > example.png
format:
  seaborn:
    clustermap:
      annot: false

EOF

Metadata

Release files for aclustermap 0.1.7

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

Source distribution (sdist)

Source distribution for aclustermap 0.1.7
File Size Uploaded Provenance Actions
aclustermap-0.1.7.tar.gz 3.8 kB Without provenance Details for aclustermap-0.1.7.tar.gz

Built distribution (wheel)

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

Total release size: 8.9 kB

Release files / aclustermap-0.1.7.tar.gz

Download URL aclustermap-0.1.7.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a1b448c00fd46414d5537f63f933101d8ba39e014cdaf8ef950423e23447ae93
BLAKE2b-256 checksum
How to use checksums
5909497b5189d0fd98d01f78a6312d1b427755613de2b78003a19676c69d951e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release files / aclustermap-0.1.7-py3-none-any.whl

Download URL aclustermap-0.1.7-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad42c8e42f36520f7c031670810c9e3a1316dd6a8b1b6770c61513c38eb3cd1a
BLAKE2b-256 checksum
How to use checksums
a4c59064d7ceb5c0d45d0f428334d0ee9dc75bfc52b41e74ded72aee3b6d965a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Security for aclustermap 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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