hclust2_ValueError: Passing a Normalize instance simultaneously with vmin/vmax is not supported. Please pass vmin/vmax directly to the norm when creating it

Hi am trying to develop heatmap plot using hclust2 for my data.

I updated latest versions of matplotlib to latest version 1.6.1. Having issue vmin/vamx. Command line and error out as follows. Please help me to fix this issue

hclust2.py
-i merged_abundance_table_species.txt
-o metaphlan_abundance_heatmap_species.png
–f_dist_f braycurtis
–s_dist_f braycurtis
–cell_aspect_ratio 0.5
–log_scale
–flabel_size 10 --slabel_size 10
–max_flabel_len 100 --max_slabel_len 100
–minv 0.1
–dpi 300

Traceback (most recent call last):
File “/Users/nareshmutha/opt/anaconda3/bin/hclust2.py”, line 825, in
hclust2_main()
File “/Users/nareshmutha/opt/anaconda3/bin/hclust2.py”, line 822, in hclust2_main
hm.draw()
File “/Users/nareshmutha/opt/anaconda3/bin/hclust2.py”, line 678, in draw
im = ax_hm.imshow( self.numpy_matrix, #origin=‘lower’,
File “/Users/nareshmutha/opt/anaconda3/lib/python3.9/site-packages/matplotlib/_api/deprecation.py”, line 454, in wrapper
return func(*args, **kwargs)
File “/Users/nareshmutha/opt/anaconda3/lib/python3.9/site-packages/matplotlib/init.py”, line 1423, in inner
return func(ax, *map(sanitize_sequence, args), **kwargs)
File “/Users/nareshmutha/opt/anaconda3/lib/python3.9/site-packages/matplotlib/axes/_axes.py”, line 5609, in imshow
im._scale_norm(norm, vmin, vmax)
File “/Users/nareshmutha/opt/anaconda3/lib/python3.9/site-packages/matplotlib/cm.py”, line 436, in _scale_norm
raise ValueError(
ValueError: Passing a Normalize instance simultaneously with vmin/vmax is not supported. Please pass vmin/vmax directly to the norm when creating it.

Hi @nareshmvr
Your problem might be due to a newer version of matplotlib that do not support anymore the min/max requirements. I would suggest to downgrade your matplotlib version to 1.5.3 and try again

Hi Aitor,

Thank you very much for the response. I even tried matplotlib v1.5.3 initially then I upgraded it to the latest version. It worked ignoring params --minv and log scale.

I generated heatmap with R using this data :slight_smile: