Skip to main content

Tool for creating heatmaps, where rows and columns are organized by hierarchical clusters as seen in

Project description

# pydendroheatmap - a plotting tool for making heatmaps with hierarchically clustered data in python.

pydendroheatmap is registered as a package on PyPI, so to install, simply type

pip install pydendroheatmap

To install the package from source, download the repository, unpack and open a command line prompt in the unpackaged directory. Then simply type:

python install

To make a plot, simply import the package, and create a DendroHeatMap object. Data for the heatmap and
dendrogram do not need to be specified at the time of creation, however, if no data is supplied then
the plot for these objects will not be rendered. See example uses below.

The data for the heat map should be either a numpy.ndarray or numpy.matrix object, and the top and left dendrogram
data should be in the form of a (n-1) x 4 linkage matrix used in the scipy hierarchical clustering package.

import pydendroheatmap as pdh
try: import cPickle as pickle
except: import pickle

heatmap_array = pickle.load(open('some_data_file.pickle'))#a numpy.ndarray or numpy.matrix, for this example, let's say mxn array
top_dendrogram = pickle.load(open('another_data_file.pickle'))#a (n-1) x 4 array
side_dendrogram = pickle.load(open('a_third_data_file.pickle'))#a (m-1) x 4 array

heatmap = pdh.DendroHeatMap(heat_map_data=heatmap_array, left_dendrogram=side_dendrogram, top_dendrogram=top_dendrogram)
heatmap.title = 'This is an example'

heatmap.colormap = heatmap.yellowBlackBlue

heatmap.row_labels = ['some', 'row','labels'] #must have the same number of rows in heat_map_data


#excellent, let's export it


To see a built-in example, run these commands in the python interpreter:

from pydendroheatmap import example

The example should make a plot that will look similar to this:

![Example Image](

The DendroHeatMap object's `render_plot()` function will generate a heat plot, similar in fashion to the one found here:

Each time the DendroHeatMap object's `show()`, `export()`, and `render_plot()` functions are called,
the plot will be reset and any changes that have been made to the plot's instance variables should be taken into account
in the new plot.

A special thanks to [Nathan Salomonis]( for posting the
original example and figuring out much of the parameters for getting the plots in the correct position!

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 pydendroheatmap, version 1.5
Filename, size File type Python version Upload date Hashes
Filename, size pydendroheatmap-1.5-py3-none-any.whl (9.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pydendroheatmap-1.5.tar.gz (8.4 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