DingWB / PyComplexHeatmap

PyComplexHeatmap: A Python package to plot complex heatmap (clustermap)
https://dingwb.github.io/PyComplexHeatmap/
MIT License
295 stars 32 forks source link

oncoPrintPlotter get wrong column split #37

Closed sen1019san closed 1 year ago

sen1019san commented 1 year ago

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

sen1019san commented 1 year ago

I have found the problem, the figure width I set was 18, smaller than the variant count width (131.8)

DingWB commented 1 year ago

Thank you for your feedback.