Skip to main content

imagesc

Python PyPI Version License Downloads

  • imagesc is an Python package to create heatmaps. Various methods to create a heatmap are implemented, each with specific properties that can help to easily create your heatmap. The fast and fastclean method is optimized for speed, the cluster method provides clustering, the seaborn method contains many configuration settings, and finally, the plot as good as possible the imagesc from matlab.

Functions in imagesc

# data is your numpy array
fig = imagesc.seaborn(data)
fig = imagesc.cluster(data)
fig = imagesc.fast(data)
fig = imagesc.clean(data)
fig = imagesc.plot(data)
status = imagesc.savefig(fig)

Contents

Installation

  • Install imagesc from PyPI (recommended). imagesc is compatible with Python 3.6+ and runs on Linux, MacOS X and Windows.
  • It is distributed under the MIT license.

Requirements

pip install numpy pandas matplotlib seaborn
Note that: seaborn is only required when using **seaborn** or **cluster** functions.
or
pip install -r requirements.txt

Quick Start

pip install imagesc
  • Alternatively, install imagesc from the GitHub source:
git clone https://github.com/erdogant/imagesc.git
cd imagesc
python setup.py install

Import imagesc package

import imagesc as imagesc

seaborn - The heatmap implemented using seaborn contains a large number of configurations possibilities.

df = pd.DataFrame(np.random.randint(0,100,size=(10,20)))
A = imagesc.seaborn(df.values, df.index.values, df.columns.values)
B = imagesc.seaborn(df.values, df.index.values, df.columns.values, annot=True, annot_kws={"size": 12})
C = imagesc.seaborn(df.values, df.index.values, df.columns.values, annot=True, annot_kws={"size": 12}, cmap='rainbow')
D = imagesc.seaborn(df.values, df.index.values, df.columns.values, annot=True, annot_kws={"size": 12}, cmap='rainbow', linecolor='#ffffff')

A B C D

cluster - The heatmap created using the cluster implementation is usefull when you desire to cluster your data.

df = pd.DataFrame(np.random.randint(0,100,size=(10,20)))
fig_C1 = imagesc.cluster(df.values, df.index.values, df.columns.values)
fig_C2 = imagesc.cluster(df.values, df.index.values, df.columns.values, cmap='rainbow')
fig_C3 = imagesc.cluster(df.values, df.index.values, df.columns.values, cmap='rainbow', linecolor='#ffffff')
fig_C4 = imagesc.cluster(df.values, df.index.values, df.columns.values, cmap='rainbow', linecolor='#ffffff', linewidth=0)
imagesc.savefig(fig_C1, './docs/figs/cluster4.png')

C1 C2 C3 C4

fast - The heatmap created using the fast implementation

df = pd.DataFrame(np.random.randint(0,100,size=(10,20)))
fig_F1 = imagesc.fast(df.values, df.index.values, df.columns.values)
fig_F2 = imagesc.fast(df.values, df.index.values, df.columns.values, grid=False)
fig_F3 = imagesc.fast(df.values, df.index.values, df.columns.values, grid=False, cbar=False)
fig_F4 = imagesc.fast(df.values, df.index.values, df.columns.values, grid=True, cbar=False)
fig_F5 = imagesc.fast(df.values, df.index.values, df.columns.values, cmap='rainbow')
fig_F6 = imagesc.fast(df.values, df.index.values, df.columns.values, cmap='rainbow', linewidth=0.5, grid=True)
imagesc.savefig(fig_C1, './docs/figs/fast1.png')

F1 F2 F3 F4 F5 F6

fastclean - The heatmap created using the fastclean implementation is fast and clean with almonst no configurations settings.

df = pd.DataFrame(np.random.randint(0,100,size=(10,20)))
fig_FC1 = imagesc.fastclean(df.values)
fig_FC2 = imagesc.fastclean(df.values, cmap='rainbow')
imagesc.savefig(fig_C1, './docs/figs/fastclean1.png')

F1 F2

plot - The heatmap created using the plot implementation will behave more-or-less as the one of matlab.

df = pd.DataFrame(np.random.randint(0,100,size=(10,20)))
fig_M1 = imagesc.plot(df.values)
fig_M2 = imagesc.plot(df.values, cbar=False)
fig_M3 = imagesc.plot(df.values, cbar=False, axis=False)
fig_M4 = imagesc.plot(df.values, cbar=False, axis=True, linewidth=0.2)
fig_M5 = imagesc.plot(df.values, df.index.values, df.columns.values)
fig_M6 = imagesc.plot(df.values, df.index.values, df.columns.values, cbar=False, linewidth=0.2)
fig_M7 = imagesc.plot(df.values, df.index.values, df.columns.values, grid=True, cbar=False, linewidth=0.2)
fig_M8 = imagesc.plot(df.values, df.index.values, df.columns.values, grid=False, cbar=False, linewidth=0.2)
fig_M9 = imagesc.plot(df.values, df.index.values, df.columns.values, grid=True, cbar=False, linewidth=0.8, linecolor='#ffffff')
fig_M10 = imagesc.plot(df.values, df.index.values, df.columns.values, grid=True, cbar=False, linewidth=0.8, linecolor='#ffffff', cmap='rainbow')
imagesc.savefig(fig, './docs/figs/plot10.png')imagesc.savefig(fig_C1, './docs/figs/fast1.png')

M1 M2 M3 M4 M5 M6 M7 M8 M9 M10

Speed:

The heatmap based on plot will behave more-or-less as the one of matlab.

import matplotlib.image as mpimg
img=mpimg.imread('./docs/figs/lenna.png')

fig = imagesc.fastclean(img)
# runtime 1.49

fig = imagesc.fast(img, cbar=False, axis=False)
# runtime: 2.931 seconds

fig = imagesc.plot(img, linewidth=0, cbar=False)
# runtime: 11.042

**fast** **fastclean** **plot**

Citation

Please cite imagesc in your publications if this is useful for your research. Here is an example BibTeX entry:

@misc{erdogant2019imagesc,
  title={imagesc},
  author={Erdogan Taskesen},
  year={2019},
  howpublished={\url{https://github.com/erdogant/imagesc}},
}

References

Maintainers

Contribute

  • Contributions are welcome.

© Copyright

See LICENSE for details.

Download files

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

Source Distribution

imagesc-0.1.2.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imagesc-0.1.2-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file imagesc-0.1.2.tar.gz.

File metadata

  • Download URL: imagesc-0.1.2.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

File hashes

Hashes for imagesc-0.1.2.tar.gz
Algorithm Hash digest
SHA256 164d0339bfe6b3e8d6616b50fea804de0831f20ee34af5218f3305b91f24da88
MD5 84c20bf2b9fd9c0c0adc5700eaf21a92
BLAKE2b-256 1a7cbe2f9e59e05bf679bce52275781caf6ea84f0c48519b9f57c9fc7397a7ce

See more details on using hashes here.

File details

Details for the file imagesc-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: imagesc-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

File hashes

Hashes for imagesc-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 832dd45639fe1603337e4b7306716f299738c731b28afc887655c413decf1bce
MD5 e9e0c4bb3676a71d1589d0b26ca816a8
BLAKE2b-256 f8df5c1bb6c045492bb8df90f2e3ece8cc772118f664e5d8c6d135158d0bbd9f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page