Skip to main content

Author: Matthias Bieg

hmap: Python Heatmap Package

This package implements a convenient heatmap plotting package in python. It offers low level functions for

  1. Plotting
    • Heatmaps
    • Dendrograms
    • Annotations
    • Legends
  2. Figure layouting

Clustered heatmap

Clustered Heatmap

Grouped clustered heatmap

Grouped Clustered Heatmap

Figure layout

The hmap package comes with a module for defining the layout of a figure using absolute length measurements. Currently the only unit supported is milimeters. The layout of a figure is defined as a grid. You have to specify

  • the number of rows,
  • the number of columns,
  • the widths of the columns,
  • the heights of the rows,
  • the vertical distance between adjacent rows,
  • the horizontal distance between adjacent columns,
  • the size of the bottom border margin,
  • the size of the top border margin,
  • the size of the left border margin, and
  • the size of theright border margin As said before, the sizes are given in milimeters.

Example

import sys
import hmap
import matplotlib.pyplot as plt

fig, gs = hmap.layout.layout.layoutGrid(4, 5, [10., 2., 40., 40., 40], [10., 2., 40., 40.], 1., 1., 20., 15., 15., 20.)
col_widths = ["10 mm", "2 mm", "40 mm", "40 mm", "40 mm"]
row_heights = ["10 mm", "2 mm", "40 mm", "40 mm"]

for row_idx in range(4):
    for col_idx in range(5):
        ax = plt.subplot(gs[row_idx, col_idx])
        plt.xticks([], [])
        plt.yticks([], [])
        if(row_idx == 0):
            ax.xaxis.set_label_position("top")
            plt.xlabel(col_widths[col_idx], 
                       fontsize=7, 
                       rotation=90)
        if(col_idx == 0):
            plt.ylabel(row_heights[row_idx], 
                       fontsize=7, 
                       rotation=0, 
                       horizontalalignment="right",
                       verticalalignment="center")

Figure layout

Installation

pip install hmap

Usage Example

Please check the jupyter notebook for an example of how to use hmap.

Acknowledgements

This package was implemented during my time at the German Cancer Research Center in the group of Theoretical Bioinformatics headed by Prof. Dr. Roland Eils, where i was part of the core bioinformatics team of the Heidelberg Institute of Personalized Oncology (HIPO). Further refinment and final upload to PyPI was done during my time at Charite, Universitaetsmedizin Berlin, Berlin Institute of Health (BIH) in the Department of Digital Health headed by Prof. Roland Eils.

License

Copyright (c) 2021, Matthias Bieg

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Metadata

Release files for hmap 0.9.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 hmap 0.9.2
File Size Uploaded Provenance Actions
hmap-0.9.2.tar.gz 12.3 kB Without provenance Details for hmap-0.9.2.tar.gz

Built distribution (wheel)

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

Total release size: 24.1 kB

Release files / hmap-0.9.2.tar.gz

Download URL hmap-0.9.2.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
95a98e62113b5a64e3f0faeb37e7e0e397507ddcb1c551e33388ba01cfa376e8
BLAKE2b-256 checksum
How to use checksums
3be0c66e2c1b032c5e3f42042a0b872d3fe2cb2c9f450e77dc5c14d1d1f8c71b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.1

Release files / hmap-0.9.2-py3-none-any.whl

Download URL hmap-0.9.2-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
69eddf6873e73778a98cc8be80d3907135a913ddf5297f5bce560b704a759514
BLAKE2b-256 checksum
How to use checksums
16ea805d7cae40a73f395b6b3a300dc0a7035a0cc8cb850add38e7d22ab10c62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.1

Security for hmap 0.9.2

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