Package: imagesc
imagescimagesc 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. Thefastandcleanmethod is optimized for speed, theclustermethod provides clustering, theseabornmethod contains many configuration settings, and finally, theplotas good as possible the imagesc from matlab.Star this repo if you like it! ⭐️Functions in imagesc# X is your numpy arrayfig=imagesc.seaborn(X)fig=imagesc.cluster(X)fig=imagesc.fast(X)fig=imagesc.clean(X)fig=imagesc.plot(X)status=imagesc.savefig(fig)path=imagesc.d3(df)ContentsInstallationRequirementsQuick StartContributeCitationMaintainersLicenseInstallationInstall 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# Note that: seaborn is only required when using **seaborn** or **cluster** functions.pipinstall-rrequirements.txtInstallation from Pypipip install imagescImport imagesc packageimportimagescasimagescd3Implemention is based ond3InteractiveStand-alonehttps://d3-graph-gallery.comdf=pd.DataFrame(np.random.randint(0,100,size=(50,50)))imagesc.d3(df,vmax=1)seabornUnderlying implemented is based onseabornLarge number of configurationsSlow when using large datasetsGrid is aligned to the cellsSee here for all parameters:https://seaborn.pydata.org/generated/seaborn.heatmap.htmldf=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')ABCDclusterUnderlying implemented is based onclustermapWhen you desire to cluster your heatmapDefault distance setting: metric="euclidean", linkage="ward" (can be changed)Slow for large data setsGrid is aligned to the cellsPossibilities to tweakPossible arguments:https://seaborn.pydata.org/generated/seaborn.clustermap.htmldf=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')C1C2C3C4fastUnderlying implemented is based onpcolorfastFastNot so much tweakableGrid isnotaligned to the cellsPossible arguments:https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.axes.Axes.pcolorfast.htmldf=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')F1F2F3F4F5F6cleanUnderlying implemented is based onpcolorfastFastNo GridLimited configurationsIdeal for photosPossible arguments:https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.axes.Axes.pcolorfast.htmldf=pd.DataFrame(np.random.randint(0,100,size=(10,20)))fig_FC1=imagesc.clean(df.values)fig_FC2=imagesc.clean(df.values,cmap='rainbow')imagesc.savefig(fig_C1,'./docs/figs/clean1.png')F1F2plotUnderlying implemented is based onimshowimplementation will behave more-or-less as the one of matlabMedium speedVarious configurations are possible but less thenseabornGrid is aligned to the cellsPossible arguments:https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.imshow.htmldf=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')M1M2M3M4M5M6M7M8M9M10Speed:importmatplotlib.imageasmpimgimg=mpimg.imread('./docs/figs/lenna.png')fig=imagesc.clean(img)# runtime 1.49fig=imagesc.fast(img,cbar=False,axis=False)# runtime: 2.931 secondsfig=imagesc.plot(img,linewidth=0,cbar=False)# runtime: 11.042**fast****clean****plot**CitationPlease 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}},}Referencesseabornhttps://seaborn.pydata.org/generated/seaborn.heatmap.htmlclustermaphttps://seaborn.pydata.org/generated/seaborn.clustermap.htmlfast and cleanhttps://matplotlib.org/3.1.1/api/_as_gen/matplotlib.axes.Axes.pcolor.htmlplothttps://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.imshow.htmlOtherhttps://matplotlib.org/3.1.1/gallery/images_contours_and_fields/image_annotated_heatmap.htmlColormaphttps://matplotlib.org/examples/color/colormaps_reference.htmlMaintainerErdogan Taskesen, github:erdogantContributions are welcome.If you wish to buy me aCoffeefor this work, it is very appreciated :)