Code Monkey home page Code Monkey logo

pycomplexheatmap's Introduction

PyComplexHeatmap Downloads Downloads Downloads

PyComplexHeatmap is a Python package to plot complex heatmap (clustermap). Please click here for documentation.

Documentation:


https://dingwb.github.io/PyComplexHeatmap

PYPI

Wiki

wiki/layout
wiki/Parameters
wiki/Features

Dependencies:


  • matplotlib>=3.3.1
  • numpy
  • pandas
  • scipy
  • fastcluster
pip install --ignore-install matplotlib numpy pandas fastcluster

Citation

Ding, W., Goldberg, D. and Zhou, W. (2023), PyComplexHeatmap: A Python package to visualize multimodal genomics data. iMeta e115. https://doi.org/10.1002/imt2.115
DOI: 10.1002/imt2.115

Installation


  1. Install using pip:
pip install PyComplexHeatmap

#upgrade from older version
pip install --upgrade PyComplexHeatmap
  1. Install the developmental version directly from github:
pip install git+https://github.com/DingWB/PyComplexHeatmap

if you have installed it previously and want to update it, please run pip uninstall PyComplexHeatmap and install from github again OR

git clone https://github.com/DingWB/PyComplexHeatmap
cd PyComplexHeatmap
python setup.py install

Example output

Click picture to view the source code

More Examples

https://dingwb.github.io/PyComplexHeatmap/build/html/more_examples.html

Call for Contributions


The PyComplexHeatmap project welcomes your expertise and enthusiasm!

Small improvements or fixes are always appreciated. If you are considering larger contributions to the source code, please contact us ([email protected]).

Writing code isn’t the only way to contribute to PyComplexHeatmap. You can also:

  • review pull requests
  • help us stay on top of new and old issues
  • develop tutorials, presentations, and other educational materials
  • maintain and improve our website
  • develop graphic design for our brand assets and promotional materials
  • translate website content
  • help with outreach and onboard new contributors
  • put forward some new ideas about update.

pycomplexheatmap's People

Contributors

ajinkya-kulkarni avatar dakomura avatar demian1 avatar dingwb avatar firefly-cpp avatar johanneswerner avatar tanjimin avatar welyt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pycomplexheatmap's Issues

Cluster mitake occur in pyHeatmap

I just install pycomplexheatmap==1.6.5
pyComplextHeatmap used (col_split=2, row_split=3) as an clustering example in its document, yet when I add col_split to 3 or 3+, it will make mistake easily

cm = ClusterMapPlotter(data=df_heatmap, top_annotation=col_ha, col_split=3, row_split=6, col_split_gap=0.5,
row_split_gap=1,label='values',row_dendrogram=True, col_dendrogram=True,show_rownames=False,show_colnames=False,
tree_kws={'row_cmap': 'Dark2', 'col_cmap': 'Dark2'},cmap='Spectral_r', legend_gap=5,legend_hpad=2,legend_vpad=5)

ValueError: The number of observations cannot be determined on an empty distance matrix.

So this situation appears in my data too, and what's even worse, some branches are in the wrong place.

cm = ClusterMapPlotter(data=data, label='values', 
                       col_split=2, row_split=3,
                       # row_cluster_method="average", row_cluster_metric="correlation",
                       # col_cluster_method="average", col_cluster_metric="correlation",
                       # tree_kws={'row_cmap': 'Dark2'},
                       row_dendrogram=True, col_dendrogram=True, cmap='Spectral_r', show_rownames=True, show_colnames=True
                       )
mistake_pycomplexheatmap I Hope the author could find it well and help me to solve it.

anno_scatterplot with custom cmap/colors

Hi! Is it possible to make the scatterplot with custom colors? I tried to give my color list as colors, but that argument accepts only single color, tried providing my color list as ListedColormap(list_of_colors), but cmap accepts only strings as an argument. Is there any way?

Color center?

Hi

Is there a way to center the color bar around a specific number? For instance, centering at 0, without having to Z_score or scale by rows/columns?

Thanks

Question about the function of `row_split` or `col_split`

It seems the functions of row_split and col_split are a bit weird. See the example below:

import pandas as pd
from PyComplexHeatmap import *
data = pd.DataFrame([[0,1],
                     [1,0],
                     [0,1],
                     [1,0],
                     [0,1]])
ClusterMapPlotter(data=data, linewidth=1, row_dendrogram=True, row_cluster=True)

After adding row_split=2, one should expect to see the first two rows in the above image separated from the rest three rows. However, it looks like this is not the case and ClusterMapPlotter returns something different.

import pandas as pd
from PyComplexHeatmap import *
data = pd.DataFrame([[0,1],
                     [1,0],
                     [0,1],
                     [1,0],
                     [0,1]])
ClusterMapPlotter(data=data, linewidth=1, row_dendrogram=True, row_cluster=True, row_split=2, row_split_gap=5)

Do you have any opinion on this?

Update code structure

I would like to standardize the code structure to adapt the code to common style guidelines.

I understand that this is a larger change, however I believe that it will improve the readability of the codebase and makes it easier maintainable.

Displaying images in place of text labels for heatmaps

I'm a pathology image analysis researcher and use your library for creating heatmaps.

I would appreciate if you could add a feature allowing images to be displayed as labels for each feature (row) in the heatmap, instead of text labels.
This enhancement would greatly aid in visual data interpretation in pathology image analysis.

Thank you for considering my suggestion.

anno_simple colors are wrong

I want to plot 22 groups on top of my heatmap with light and dark grey.
For the colors argument I'm using the following dictionary:

{1: '#999993',
 2: '#eeeee4',
 3: '#999993',
 4: '#eeeee4',
 5: '#999993',
 6: '#eeeee4',
 7: '#999993',
 8: '#eeeee4',
 9: '#999993',
 10: '#eeeee4',
 11: '#999993',
 12: '#eeeee4',
 13: '#999993',
 14: '#eeeee4',
 15: '#999993',
 16: '#eeeee4',
 17: '#999993',
 18: '#eeeee4',
 19: '#999993',
 20: '#eeeee4',
 21: '#999993',
 22: '#eeeee4'}

And then plot the heatmap like this:

plt.figure(figsize=(10, 5))


cols = HeatmapAnnotation(chromosome = anno_simple(cut_chroms.chromosome,add_text=True, colors = colors, text_kws ={"color": "black"} )
                         ,plot_legend = True,axis = 1,plot = False)
cm1 = ClusterMapPlotter(data=hm,row_dendrogram=True,show_rownames=False,show_colnames=False,top_annotation = cols,
                       row_cluster_metric = "euclidean",col_cluster = False,
                      row_cluster = True, label='Expression')

plt.show()

image
As you see, in the initial dictionary group 16 was supposed to be light grey (unlike 15 and 17) and you can also see that in the legend it's light grey, but in the heatmap it's dark grey. Could you please suggest what might be an issue?

Try to save results from ClusterMapPlotter as pdf, but the heatmap is a figure not in vector

Try to save results from ClusterMapPlotter as pdf, but the heatmap is a figure not in vector.

`plt.figure(figsize=(6, 30))
cm = ClusterMapPlotter(data=data.loc[:,df_col.index.tolist()],
top_annotation=col_ha,show_rownames=True,
row_cluster=True,col_cluster=False,
label='on/off',legend_gap=7,
cmap='Purples',rasterized=True)

plt.savefig(root + "test.pdf")
plt.show()
`

Suggestion for heatmap of categorical data

Hi Wubin,

I noticed that PyComplexHeatmap currently treats categorical data the same way as continuous data, presenting the legend as a color bar instead of categorical labels. Do you have any plans to improve this feature? I came across a great repository called catheat (https://github.com/schlegelp/catheat) that uses seaborn to handle categorical data. It would be fantastic to see this integrated into PyComplexHeatmap.

cluster_between_groups and col_split_order: allow custom col_split_order after clustering the groups specified with col_split

Is your feature request related to a problem? Please describe.
Desire to use col_split and col_split_order to specify my column splits and the order in combination with clustering between groups.

Describe the solution you'd like
I would like to control the col_split_order after cluster_between_groups has been used to do the mean clustering of my groups specified with col_split.

Describe alternatives you've considered
None, but I could use cluster_between_groups and use a vector graphics program for instance to reorder the groups which would be a bit messy.

Additional context

get_cmap warning

MatplotlibDeprecationWarning: The get_cmap function was deprecated in Matplotlib 3.7 and will be removed two minor releases later. Use matplotlib.colormaps[name] or matplotlib.colormaps.get_cmap(obj) instead

Incomplete display of column name

The picture does not display the full column name by default. I guess it may be due to occlusion (should all column names be displayed even if they are directly occluded?). I now solve this problem by increasing the width of the picture.
image

composite Clustermap enforces same dimensions for both clustermaps

When trying to plot two clustermaps that share one axis, PyComplexHeatmap.clustermap.composite() enforces both column and indexes to be the same as the main cluster map.

This is enforced in the following code:

for i, cm in enumerate(cmlist):
        if i == main:
            continue
        gs1 = gs[i, 0] if axis == 0 else gs[0, i]
        cm.plot(ax=axes[i], subplot_spec=gs1, row_order=cm_1.row_order, col_order=cm_1.col_order)
        for L in cm.legend_list:
            if L[1] not in legend_names:
                legend_names.append(L[1])
                legend_list.append(L)
        w = ax.figure.get_window_extent().width * cm.label_max_width / cm.ax.figure.get_window_extent().width
        if w > label_max_width:
            label_max_width = w

The parameters row_order and col_order in cm.plot should be given dynamically depending on whether axis = 0 or axis = 1

Proprietary Microsoft font Arial generates warnings for each label on certain systems

The use of the proprietary Microsoft font Arial generates a warning for each time a label is printed out on any system that doesn't have that font installed. Choice of specific fonts (especially proprietary ones) is best left to the user.

I would recommend only specifying the "Sans-serif" font family and then letting the user's matplotlib installation use whichever applicable font of that type they have installed instead of specifying a specific font.

Adjusting width/height of heatmap?

Is there a way to adjust the width and height of the heatmap?
I have tried to create a figure with plt.figure(figsize=(3,5)) before calling ClusterMapPlotter to make the heatmap skinnier. However, this forces the legend to get cut off, even when I save the figure with bbox_inches='tight'.

Your wiki page is GitHub theme dependent

Hi,

The images you use in your wiki page seem to be GitHub theme dependent. I had to change my GitHub theme to view them properly. My default them is "Dark default". When I view the wiki page with that theme, this is what I see:

screenshot - dark theme

But when I switch to the "Light default" theme, I see everything properly:

screenshot - light theme

Questions about legend and colorbar settings

Dear Wubin,

Thank you very much for creating this incredibly useful package. I have three questions regarding some settings.

  1. How can I set the frameon to False for categorical legends?
  2. How can I set the colorbar attributes such as aspect or orientation?
  3. Apparently if row_split or col_split is not set to None axes are visible, how one in this case can turn them off?

Thank you in advance for your time.

Missing annotation

version 1.6.1
matplotlib ver. 3.8.0
numpy ver. 1.26.1
pandas ver. 2.1.1
I ran the example code and the resulting figure only showed part of the annotation.
output

How to remove arrows for anno_label

I'm wondering how to remove the arrows from anno_label and just show the labels alone? I've tried changing values for the arrowprops argument and relpos but whatever I do I can't get rid of the lines. I can't find anything in the docs or the source to help but would love to be able to do this.
Thanks!

The color of the histogram does not match the original data frame

df_bar = pd.DataFrame(np.random.uniform(0, 10, (10, 3)), columns=['TMB1', 'TMB2', 'TMB3']) print(df_bar) plt.figure(figsize=(6, 6)) col_ha = HeatmapAnnotation(bar=anno_barplot(df_bar,legend=True), plot=True,legend=True,legend_gap=3, legend_width=20) plt.show()
image

GH tag for 1.3.1 is missing

Please provide a tag for the 1.3.1 release. Tag helps us in easier packaging of this package in the other ecosystems.

MatplotlibDeprecationWarning

The register_cmap function was deprecated in Matplotlib 3.7 and will be removed two minor releases later. Use matplotlib.colormaps.register(name) instead.

Question about the legend visualization.

Dear wubin:

Thank you so much for creating this wonderful package , I have a question about the legend visualization . In my datasets , the legend was not fully visualized , see the code below , and the datasets were uploading here .

# 横注释
col_ha = HeatmapAnnotation(#label=anno_label(obs.loc[:,'T/NK_type'], colors=type_color_TNK, merge=True,rotation=15), # 设置是否有对T/NK_type的文字注释
               T_NK_type=anno_simple(obs.loc[:,'T/NK_type'], colors=type_color_TNK, add_text=False, legend=True, height=8),axis=1, # 绘制T/NK_type注释
               T_NK_celltype=anno_simple(obs.loc[:,'T/NK_celltype'], colors=type_color_rna, add_text=False, legend=True, height=8), # 绘制T/NK_celltype注释
               plot=False,legend=False,legend_gap=3,legend_hpad=1,legend_width=3
                           )
# 纵注释
row_ha = HeatmapAnnotation(#label=anno_label(obs.loc[:,'T/NK_type'], colors=type_color_TNK, merge=True,rotation=15), # 设置是否有对T/NK_type的文字注释
               Gene=anno_simple(var.loc[:,'celltype'], colors=type_color_rna, add_text=False, legend=True, height=8),axis=0, # 绘制T/NK_type注释
               plot=False,legend=False,legend_gap=3,legend_hpad=1,legend_width=3
                           )
plt.figure(figsize=(8, 16))
# 绘制注释
# 绘制基因表达图
cm = ClusterMapPlotter(data=Gene_Expression.T, #z_score = True,
                       top_annotation = col_ha, # 设置上注释
                       left_annotation = row_ha, # 设置左注释
                       row_cluster = False, # 设置禁止自动聚类!!!
                       col_cluster = False, # 设置禁止自动聚类!!! 这个逼函数聚类参数默认是True
                       row_names_side = 'right',  # 基因名放右边
                       col_split = obs.loc[:,'T/NK_type'] , # 设置纵轴分割
                       row_split = var.loc[:,'celltype'] , # 设置横轴分割
                       label='values',  # 热图颜色设置
                       row_dendrogram = False,
                       show_rownames = True,
                       show_colnames = False,
                       cmap ='PuBu' , # Values的色卡
                       legend = False, # 不画图例
                      # legend_hpad = 0.5,#热图和图例之间间隙
                      # legend_vpad = 0.5,
                      # legend_side = 'left', # 图例放左边
                       row_split_gap = 2, # 横向分割间距
                       col_split_gap = 0.4, # 纵向分割间距
                    # tree_kws={'row_cmap': 'Dark2'}
                    )

# [Gene_Expression.csv](https://github.com/DingWB/PyComplexHeatmap/files/10553588/Gene_Expression.csv)
plt.savefig("Figure2_marker.png",dpi=300,bbox_inches = 'tight')
plt.savefig("/content/drive/MyDrive/Gastric/Figure/Figure2/Figure2_marker.png",dpi=300,bbox_inches = 'tight')
plt.show()

clusterheatmap

datasets:
var.csv
obs.csv
Gene_Expression.csv

oncoPrintPlotter get wrong column split

Hi, PyComplexHeatmap provides Python users with convenient heatmap painting tools. I want to display variants in a population using oncoPrintPlotter. I want to show SampleID in rows and VariantID in columns. Here is the code:

cols = ['0/0','0/1','1/1','./.']
colors = ['#552365','#2e9a95','#f7eb3c','#050707']

plt.figure(figsize=(18,20))
op = oncoPrintPlotter(data = stack_df,x = 'VariantID',y = 'SampleID',
                    values = cols,colors = colors,label = 'Genotype',
                    legend_hpad = 0,show_rownames = True,show_colnames = True,
                    width = 1.8,row_gap = 0)
plt.savefig(query_region_variant_plot,bbox_inches='tight')
plt.show()

The heatmap gets the wrong variant split shown in the red circles:
image
I set the VariantID as the x-axis. The ticklabels in the figure cannot match the heatmap columns. And the column number in the heatmap is obviously great than the VariantID count.

The input stack_df contains the genotype information for each variant :
image
Here I show the input file and the output figure.
input data
variant_stack_record.txt
output figure
variant_plot.pdf

The color of the histogram does not match the original data frame

df_bar = pd.DataFrame(np.random.uniform(0, 10, (10, 3)), columns=['TMB1', 'TMB2', 'TMB3']) print(df_bar) plt.figure(figsize=(6, 6)) col_ha = HeatmapAnnotation(bar=anno_barplot(df_bar,legend=True), plot=True,legend=True,legend_gap=3, legend_width=20) plt.show()
image

optimizing and sorting dendrogram

In the complexheatmap of R, there is a parameter called cluster_columns or clusters_rows allows for the transfer of reordered Dendrogram data (such as using Dendsort packedge in R), which changes the order of the dendrogram in the heatmap and allows it to be displayed. I think this is a very useful function. In pycomplexheatmap, it seems that the order of rows or columns can be passed in, but the dendrogram cannot be displayed anymore. I think it may be possible to add a parameter cluster_ columns or clusters_ rows to pycomplexheatmap as well, an optimized link matrix can be passed in, which can change the order and corresponding clustering tree in the heatmap.

legend_width not work when set *_dendrogram=True

when set *_dendrogram=True
cm = ph.ClusterMapPlotter(
data=z_df, top_annotation=col_ha, left_annotation=row_annotation,
label='z-score', show_rownames=False, show_colnames=True, col_cluster=True,
row_cluster=True, col_split_gap=3,
col_dendrogram=True, row_dendrogram=True, legend_width=50, verbose=0)

image

when set *_dendrogram=False
image

Reordering annotation on clustermap

Discussed in #29

Originally posted by sruthi-hub April 25, 2023
First, thanks for making the complexheatmap package for python users.
I am using the DotClustermapPlotter to make a dotplot with annotations for rows and columns. I want to specify the order for teh annotation of the columns.
I see that class(AnnotationBase) has a reorder function. It would be nice to see an example to reorder the values in column annotation.

For example (provided here), if I want to change the order of the column such that I want Dataset 2 and then Dataset 1, how do I do that? Seems like this should be straight forward to do. Would appreciate your help.


row_ha = HeatmapAnnotation(
                           Category=anno_simple(df_row.Category,cmap='Set1',
                                           add_text=False,legend=False),
                           label=anno_label(df_row.Category, merge=True,rotation=0),
                           axis=0,verbose=0,label_kws={'rotation':45,'horizontalalignment':'left'})

col_ha = HeatmapAnnotation(
                           Dataset=anno_simple(df_col.Dataset,cmap='Set1',legend=False,add_text=True),
                           Correlation=anno_simple(df_col.Correlation,cmap='Dark2',legend=False,add_text=True),
                           verbose=0,label_side='left',label_kws={'horizontalalignment':'right'})

plt.figure(figsize=(5, 8))
cm = DotClustermapPlotter(data=data, x='ID',y='Term',value='-log10(Pval)',c='-log10(Pval)',s='odds_ratio',
                          hue='EnrichType', row_cluster=False,col_cluster=False,
                          cmap={'Enrich':'RdYlGn_r','Depletion':'coolwarm_r'},
                          colors={'Enrich':'red','Depletion':'blue'},
                          #marker={'Enrich':'^','Depletion':'v'},
                          top_annotation=col_ha,right_annotation=row_ha,
                          col_split=df_col.Dataset,row_split=df_row.Category, col_split_gap=0.5,row_split_gap=1,
                          show_rownames=True,show_colnames=False,row_dendrogram=False,
                          verbose=0,legend_gap=7,alpha=0.8)
#plt.savefig("dotHeatmap1.pdf",bbox_inches='tight')
plt.show()

--------------------

Missing annot when using composite

Describe the bug
Missing custom annot (stars indicating statistical significance) when using clustermap.composite. Individual ClusterMapPlotter calls successfully displayed the heatmap annotation.

Environment
Python 3.11.7
PyComplexHeatmap 1.6.4
matplotlib 3.7.1

`HeatmapAnnotation` related issue – empty labeling

I have trouble using HeatmapAnnotation. I keep getting empty annotation... any thought?

    PathwayModule = [
        'WPM' if node in list(set(sub_mat.columns) & set(gmt[geneset_name])) else 'BPM' 
        for node in sub_mat.columns
    ]
    
    fig, ax = plt.subplots(figsize=(2 * rel,1.6 * rel))
    
    col_colors_dict={
        'WPM':'#1E93AE',
        'BPM':'#FF9C00'
    }    
    col_ha = ch.HeatmapAnnotation(
        label=ch.anno_label(
            pd.Series(PathwayModule),merge=True,rotation=90,extend=True,
            adjust_color=True,luminance=0.75,
            colors=col_colors_dict,
            relpos=(0.5,0)
        ),
        PathwayModule=ch.anno_simple(
            pd.Series(PathwayModule),
            colors=col_colors_dict,
        ), axis=1,
        label_side='right',
        verbose=0,
        # plot=False,
        legend=False
    )
    plot_cm = ch.ClusterMapPlotter(
        sub_mat,
        legend_gap=5,legend_width=5,legend_hpad=2,legend_vpad=5,
        right_annotation=col_ha,
        col_dendrogram=True,
        row_dendrogram=True,
        vmin=-1, vmax=1,
        cmap = 'BlueYellow',
        verbose=False,
        legend=False,
        # plot=False,
        # show_rownames=True,show_colnames=True
    )
    

image

Kmeans clustering when using ClusterMapPlotter function

Will the Pycomplexheatmap support Kmeans clustering when using ClusterMapPlotter function. I just mean that first use Kmeans to form different goups, then run hierarchical clustering within each group, finally hierarchically cluster different groups. The R package complexheatmap support the process.
Thanks!

is it possible to limit colorbar vmin and vmax ?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

I am wordering can I center the colorbar with white representing 0 values ??
plt.figure(figsize=(10, 4))


cm = ClusterMapPlotter(data=df_heatmap.T,
                       col_cluster=False,row_cluster=False,
                       row_split=df.Group,col_split=2,
                       col_split_gap=0.5,row_split_gap=0.8,
                       label='values',row_dendrogram=True,
                       show_rownames=False,show_colnames=True,
                       tree_kws={'row_cmap': 'Set1'},verbose=0,legend_gap=5,
                       cmap='bwr',xticklabels_kws={'labelrotation':90,'labelcolor':'black'},
                       #legend_kws={'vmin':-2,'vmax':2}
                       
                      )
#plt.savefig("example0.pdf", bbox_inches='tight')
plt.show()

image

Unexpected grid potential caused by seaborn or scanpy

When other packages are imported, such as seaborn and set some kind of style, there would be a unexpected grid in heatmap

import os,sys
%matplotlib inline
import matplotlib.pylab as plt
import pickle
plt.rcParams['figure.dpi'] = 100
plt.rcParams['savefig.dpi']=300
plt.rcParams['font.family']='sans serif'
plt.rcParams['font.sans-serif']='Arial'
plt.rcParams['pdf.fonttype']=42
import pandas as pd
from PyComplexHeatmap import *
import PyComplexHeatmap as pch
print(pch.__version__)
import scanpy
#import seaborn as sns
# sns.set_style("whitegrid")
# sns.set_style("white")
df_row=pd.read_csv("df_row.csv",index_col=0)
df_row.spatial_domain=df_row.spatial_domain.astype(str)
df_col=pd.read_csv("df_col.csv",index_col=0)
df_col.chromosome=df_col.chromosome.astype(str)
data=pd.read_csv("cnv_mtr_filtered.csv",index_col=0)
df_col=df_col.sample(500)
data=data.loc[:,df_col.index.tolist()]
data
plt.figure(figsize=(10, 5))


right_annotation = HeatmapAnnotation(
                **,
                       axis=0)

top_annotation = HeatmapAnnotation(
    
                label=anno_label(df_col['chromosome'],merge=True, rotation=90),
                chromosome = anno_simple(df_col['chromosome'], add_text=False, legend_kws={'frameon':False}, 
                                         colors= dict(zip(np.arange(1,23).astype(str),['#5daab4','#000000']*11)), 
                                         legend=True), axis=1)

cm = ClusterMapPlotter(data=data, 
                       vmax=1.02, vmin=0.98, 
                       top_annotation=top_annotation,   
                       left_annotation =right_annotation ,
                       cmap='RdBu_r',  
                       row_cluster=False, col_cluster=False, 
                        col_split = df_col['chromosome'], 
                       col_split_order = [str(i) for i in list(range(1,23))],
                       col_split_gap=0.4 
                      )

When use sns.set_style("whitegrid")
or change setting in scanpy:

import scanpy
sc.settings.verbosity = 3 
sc.settings.set_figure_params(dpi=100, dpi_save=300,
                              facecolor='white', figsize=(4,4))

An unexpected grid would appear:
image

When set sns.set_style("whitegrid") or in default, the heatmap looks good:
image

Thick white lines appearning in clustermap when large genesets used

Describe the bug
I have a matrix of size 157 rows (genes) × 1023 columns (cells). When I create a clustermap plot, I get these thick white lines/ artifacts appearing in the image.

image

Expected behavior

When I reduce the size of my matrix 59 rows (genes) × 1023 columns (cells), the clustermap outputs as it should.
image

What can I do about this?

Desktop (please complete the following information):
-Linux Mint 20.1

  • Chrome
  • Jupyter Notebook

Additional context
Plots generated following this tutorial with own data

composite() got an unexpected keyword argument 'height_ratios'

Hello, thanks for developing this useful tool. I encountered while using the composite() function in PyComplexHeatmap: TypeError: composite() got an unexpected keyword argument 'height_ratios'.

I think this is the version issue that was recently added, but not completely updated in the package.
Could you provide an update to the PyComplexHeatmap package to be able to address this problem?

Thank you in advance!

Possible bug? 'lightgray' is not a valid color value.

Dear PyComplexHeatmap developers,

Thank you for the great package. I can foresee that it will speedup our data analysis.

I encountered a value error when running the example from the readme: 'lightgray' is not a valid color value.

The error can be tracked back to line 13 in the colors.py file.

Since I seem to be the only one having this issue, I thought about package compatibility issues.
Could it be that my matplotlib's version is not supported?
I'm using matplotlib 3.8.0

Thank you for checking this issue!

Here is the complete error message:

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.