{"id":17465019,"url":"https://github.com/erdogant/imagesc","last_synced_at":"2025-04-19T20:15:39.169Z","repository":{"id":57437824,"uuid":"234185416","full_name":"erdogant/imagesc","owner":"erdogant","description":"Make quick and beautiful heatmaps","archived":false,"fork":false,"pushed_at":"2022-10-07T12:33:37.000Z","size":7267,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T01:22:44.623Z","etag":null,"topics":["clustering","clustermap","d3js","heatmap","imagesc","interactive","plot","seaborn","seaborn-plots"],"latest_commit_sha":null,"homepage":"https://erdogant.github.io/imagesc","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erdogant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["erdogant"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2020-01-15T22:23:29.000Z","updated_at":"2022-10-16T20:30:04.000Z","dependencies_parsed_at":"2022-09-16T03:24:08.415Z","dependency_job_id":null,"html_url":"https://github.com/erdogant/imagesc","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdogant%2Fimagesc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdogant%2Fimagesc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdogant%2Fimagesc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdogant%2Fimagesc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erdogant","download_url":"https://codeload.github.com/erdogant/imagesc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249789713,"owners_count":21325858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clustering","clustermap","d3js","heatmap","imagesc","interactive","plot","seaborn","seaborn-plots"],"created_at":"2024-10-18T11:08:29.271Z","updated_at":"2025-04-19T20:15:39.124Z","avatar_url":"https://github.com/erdogant.png","language":"Python","funding_links":["https://github.com/sponsors/erdogant","https://www.buymeacoffee.com/erdogant)--","https://www.buymeacoffee.com/erdogant"],"categories":[],"sub_categories":[],"readme":"# imagesc\n\n[![Python](https://img.shields.io/pypi/pyversions/imagesc)](https://img.shields.io/pypi/pyversions/imagesc)\n[![PyPI Version](https://img.shields.io/pypi/v/imagesc)](https://pypi.org/project/imagesc/)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/erdogant/imagesc/blob/master/LICENSE)\n[![Github Forks](https://img.shields.io/github/forks/erdogant/imagesc.svg)](https://github.com/erdogant/imagesc/network)\n[![GitHub Open Issues](https://img.shields.io/github/issues/erdogant/imagesc.svg)](https://github.com/erdogant/imagesc/issues)\n[![Project Status](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)\n[![Downloads](https://pepy.tech/badge/imagesc/month)](https://pepy.tech/project/imagesc/month)\n[![Downloads](https://pepy.tech/badge/imagesc)](https://pepy.tech/project/imagesc)\n\u003c!---[![BuyMeCoffee](https://img.shields.io/badge/buymea-coffee-yellow.svg)](https://www.buymeacoffee.com/erdogant)--\u003e\n\u003c!---[![Coffee](https://img.shields.io/badge/coffee-black-grey.svg)](https://erdogant.github.io/donate/?currency=USD\u0026amount=5)--\u003e\n\n\n* 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 **clean** 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.\n\n# \n**Star this repo if you like it! ⭐️**\n#\n\n### Functions in imagesc\n```python\n# X is your numpy array\nfig  = imagesc.seaborn(X)\nfig  = imagesc.cluster(X)\nfig  = imagesc.fast(X)\nfig  = imagesc.clean(X)\nfig  = imagesc.plot(X)\nstatus = imagesc.savefig(fig)\npath = imagesc.d3(df)\n\n```\n\n## Contents\n- [Installation](#-installation)\n- [Requirements](#-Requirements)\n- [Quick Start](#-quick-start)\n- [Contribute](#-contribute)\n- [Citation](#-citation)\n- [Maintainers](#-maintainers)\n- [License](#-copyright)\n\n## Installation\n* Install imagesc from PyPI (recommended). imagesc is compatible with Python 3.6+ and runs on Linux, MacOS X and Windows. \n* It is distributed under the MIT license.\n\n## Requirements\n```python\n# Note that: seaborn is only required when using **seaborn** or **cluster** functions.\npip install -r requirements.txt\n```\n\n## Installation from Pypi\n```\npip install imagesc\n```\n\n## Import imagesc package\n```python\nimport imagesc as imagesc\n```\n\n### d3\n* Implemention is based on **d3**\n* Interactive\n* Stand-alone\n* https://d3-graph-gallery.com\n\n```python\ndf = pd.DataFrame(np.random.randint(0, 100, size=(50, 50)))\nimagesc.d3(df, vmax=1)\n```\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/d3_heatmap_1.png\" width=\"600\" /\u003e\n\u003c/p\u003e\n\n\n### seaborn\n* Underlying implemented is based on **seaborn**\n* Large number of configurations\n* Slow when using large datasets\n* Grid is aligned to the cells\n* See here for all parameters: https://seaborn.pydata.org/generated/seaborn.heatmap.html\n\n```python\ndf = pd.DataFrame(np.random.randint(0,100,size=(10,20)))\nA = imagesc.seaborn(df.values, df.index.values, df.columns.values)\nB = imagesc.seaborn(df.values, df.index.values, df.columns.values, annot=True, annot_kws={\"size\": 12})\nC = imagesc.seaborn(df.values, df.index.values, df.columns.values, annot=True, annot_kws={\"size\": 12}, cmap='rainbow')\nD = imagesc.seaborn(df.values, df.index.values, df.columns.values, annot=True, annot_kws={\"size\": 12}, cmap='rainbow', linecolor='#ffffff')\n```\n\u003cp align=\"center\"\u003e\n  A\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/seaborn1.png\" width=\"300\" /\u003e\n  B\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/seaborn2.png\" width=\"300\" /\u003e\n  C\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/seaborn3.png\" width=\"300\" /\u003e\n  D\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/seaborn4.png\" width=\"300\" /\u003e\n\u003c/p\u003e\n\n\n### cluster\n* Underlying implemented is based on **clustermap** \n* When you desire to cluster your heatmap\n* Default distance setting: metric=\"euclidean\", linkage=\"ward\" (can be changed)\n* Slow for large data sets\n* Grid is aligned to the cells\n* Possibilities to tweak\n* Possible arguments: https://seaborn.pydata.org/generated/seaborn.clustermap.html\n\n```python\ndf = pd.DataFrame(np.random.randint(0,100,size=(10,20)))\nfig_C1 = imagesc.cluster(df.values, df.index.values, df.columns.values)\nfig_C2 = imagesc.cluster(df.values, df.index.values, df.columns.values, cmap='rainbow')\nfig_C3 = imagesc.cluster(df.values, df.index.values, df.columns.values, cmap='rainbow', linecolor='#ffffff')\nfig_C4 = imagesc.cluster(df.values, df.index.values, df.columns.values, cmap='rainbow', linecolor='#ffffff', linewidth=0)\nimagesc.savefig(fig_C1, './docs/figs/cluster4.png')\n```\n\u003cp align=\"center\"\u003e\n  C1\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/cluster1.png\" width=\"300\" /\u003e\n  C2\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/cluster2.png\" width=\"300\" /\u003e\n  C3\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/cluster3.png\" width=\"300\" /\u003e\n  C4\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/cluster4.png\" width=\"300\" /\u003e\n\u003c/p\u003e\n\n\n### fast\n* Underlying implemented is based on **pcolorfast** \n* Fast\n* Not so much tweakable\n* Grid is **not** aligned to the cells\n* Possible arguments: https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.axes.Axes.pcolorfast.html\n\n```python\ndf = pd.DataFrame(np.random.randint(0,100,size=(10,20)))\nfig_F1 = imagesc.fast(df.values, df.index.values, df.columns.values)\nfig_F2 = imagesc.fast(df.values, df.index.values, df.columns.values, grid=False)\nfig_F3 = imagesc.fast(df.values, df.index.values, df.columns.values, grid=False, cbar=False)\nfig_F4 = imagesc.fast(df.values, df.index.values, df.columns.values, grid=True, cbar=False)\nfig_F5 = imagesc.fast(df.values, df.index.values, df.columns.values, cmap='rainbow')\nfig_F6 = imagesc.fast(df.values, df.index.values, df.columns.values, cmap='rainbow', linewidth=0.5, grid=True)\nimagesc.savefig(fig_C1, './docs/figs/fast1.png')\n```\n\u003cp align=\"center\"\u003e\n  F1\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/fast1.png\" width=\"300\" /\u003e\n  F2\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/fast2.png\" width=\"300\" /\u003e\n  F3\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/fast3.png\" width=\"300\" /\u003e\n  F4\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/fast4.png\" width=\"300\" /\u003e\n  F5\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/fast5.png\" width=\"300\" /\u003e\n  F6\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/fast6.png\" width=\"300\" /\u003e\n\u003c/p\u003e\n\n### clean\n* Underlying implemented is based on **pcolorfast** \n* Fast\n* No Grid\n* Limited configurations\n* Ideal for photos\n* Possible arguments: https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.axes.Axes.pcolorfast.html\n\n```python\ndf = pd.DataFrame(np.random.randint(0,100,size=(10,20)))\nfig_FC1 = imagesc.clean(df.values)\nfig_FC2 = imagesc.clean(df.values, cmap='rainbow')\nimagesc.savefig(fig_C1, './docs/figs/clean1.png')\n```\n\u003cp align=\"center\"\u003e\n  F1\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/clean1.png\" width=\"300\" /\u003e\n  F2\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/clean2.png\" width=\"300\" /\u003e\n\u003c/p\u003e\n\n### plot\n* Underlying implemented is based on **imshow** \n* implementation will behave more-or-less as the one of matlab\n* Medium speed\n* Various configurations are possible but less then **seaborn**\n* Grid is aligned to the cells\n* Possible arguments: https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.imshow.html\n\n```python\ndf = pd.DataFrame(np.random.randint(0,100,size=(10,20)))\nfig_M1 = imagesc.plot(df.values)\nfig_M2 = imagesc.plot(df.values, cbar=False)\nfig_M3 = imagesc.plot(df.values, cbar=False, axis=False)\nfig_M4 = imagesc.plot(df.values, cbar=False, axis=True, linewidth=0.2)\nfig_M5 = imagesc.plot(df.values, df.index.values, df.columns.values)\nfig_M6 = imagesc.plot(df.values, df.index.values, df.columns.values, cbar=False, linewidth=0.2)\nfig_M7 = imagesc.plot(df.values, df.index.values, df.columns.values, grid=True, cbar=False, linewidth=0.2)\nfig_M8 = imagesc.plot(df.values, df.index.values, df.columns.values, grid=False, cbar=False, linewidth=0.2)\nfig_M9 = imagesc.plot(df.values, df.index.values, df.columns.values, grid=True, cbar=False, linewidth=0.8, linecolor='#ffffff')\nfig_M10 = imagesc.plot(df.values, df.index.values, df.columns.values, grid=True, cbar=False, linewidth=0.8, linecolor='#ffffff', cmap='rainbow')\nimagesc.savefig(fig, './docs/figs/plot10.png')imagesc.savefig(fig_C1, './docs/figs/fast1.png')\n```\n\u003cp align=\"center\"\u003e\n  M1\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/plot1.png\" width=\"300\" /\u003e\n  M2\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/plot2.png\" width=\"300\" /\u003e\n  M3\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/plot3.png\" width=\"300\" /\u003e\n  M4\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/plot4.png\" width=\"300\" /\u003e\n  M5\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/plot5.png\" width=\"300\" /\u003e\n  M6\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/plot6.png\" width=\"300\" /\u003e\n  M7\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/plot7.png\" width=\"300\" /\u003e\n  M8\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/plot8.png\" width=\"300\" /\u003e\n  M9\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/plot9.png\" width=\"300\" /\u003e\n  M10\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/plot10.png\" width=\"300\" /\u003e\n\u003c/p\u003e\n\n\n### Speed:\n```python\nimport matplotlib.image as mpimg\nimg=mpimg.imread('./docs/figs/lenna.png')\n\nfig = imagesc.clean(img)\n# runtime 1.49\n\nfig = imagesc.fast(img, cbar=False, axis=False)\n# runtime: 2.931 seconds\n\nfig = imagesc.plot(img, linewidth=0, cbar=False)\n# runtime: 11.042\n```\n\u003cp align=\"center\"\u003e\n  **fast**\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/fast_lenna.png\" width=\"300\" /\u003e\n  **clean**\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/clean_lenna.png\" width=\"300\" /\u003e\n  **plot**\u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/plot_lenna1.png\" width=\"300\" /\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/erdogant/imagesc/blob/master/docs/figs/time_in_secs.png\" width=\"1000\" /\u003e\n\u003c/p\u003e\n\n\n\n### Citation\nPlease cite imagesc in your publications if this is useful for your research. Here is an example BibTeX entry:\n```BibTeX\n@misc{erdogant2019imagesc,\n  title={imagesc},\n  author={Erdogan Taskesen},\n  year={2019},\n  howpublished={\\url{https://github.com/erdogant/imagesc}},\n}\n```\n\n### References\n* seaborn\nhttps://seaborn.pydata.org/generated/seaborn.heatmap.html\n* clustermap\nhttps://seaborn.pydata.org/generated/seaborn.clustermap.html\n* fast and clean\nhttps://matplotlib.org/3.1.1/api/_as_gen/matplotlib.axes.Axes.pcolor.html\n* plot\n https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.imshow.html\n* Other\nhttps://matplotlib.org/3.1.1/gallery/images_contours_and_fields/image_annotated_heatmap.html\n* Colormap\nhttps://matplotlib.org/examples/color/colormaps_reference.html\n\n\n### Maintainer\n* Erdogan Taskesen, github: [erdogant](https://github.com/erdogant)\n* Contributions are welcome.\n* If you wish to buy me a \u003ca href=\"https://www.buymeacoffee.com/erdogant\"\u003eCoffee\u003c/a\u003e for this work, it is very appreciated :)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferdogant%2Fimagesc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferdogant%2Fimagesc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferdogant%2Fimagesc/lists"}