Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotting crashed for small matrix with 0 and 1 #61

Open
ievarau opened this issue Jan 26, 2024 · 1 comment
Open

Plotting crashed for small matrix with 0 and 1 #61

ievarau opened this issue Jan 26, 2024 · 1 comment

Comments

@ievarau
Copy link

ievarau commented Jan 26, 2024

Hei,

I encountered an error, where plotting crashes. I run pairwise module to compute Jaccard statistic. It results in a following matrix:

HUMAN_IRF4 HUMAN_IRF3
HUMAN_IRF4 1.0 0.0
HUMAN_IRF3 0.0 1.0

But then I get this error. I assume it cannot handle the zeroes.

/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/colorbar.py:1271: RuntimeWarning: invalid value encountered in true_divide y = y / (self._boundaries[self._inside][-1] - /lsc/easybuild/software/intervene/0.6.5-foss-2022a/lib/python3.10/site-packages/intervene/modules/pairwise/pairwise.py:291: UserWarning: Attempting to set identical left == right == 1.0 results in singular transformations; automatically expanding. cb = pl.colorbar(caxes, ax=axes, orientation='horizontal', shrink=0.5825, Traceback (most recent call last): File "/lsc/easybuild/software/intervene/0.6.5-foss-2022a/bin/intervene", line 604, in <module> main() File "/lsc/easybuild/software/intervene/0.6.5-foss-2022a/bin/intervene", line 424, in main pairwise.pairwise_intersection(label_names, options) File "/lsc/easybuild/software/intervene/0.6.5-foss-2022a/lib/python3.10/site-packages/intervene/modules/pairwise/pairwise.py", line 486, in pairwise_intersection barplot(series, matrix, outfile, options, max_size=max(bed_sizes)) File "/lsc/easybuild/software/intervene/0.6.5-foss-2022a/lib/python3.10/site-packages/intervene/modules/pairwise/pairwise.py", line 136, in barplot cax, order = heatmap_triangle(matrix, ax, options) File "/lsc/easybuild/software/intervene/0.6.5-foss-2022a/lib/python3.10/site-packages/intervene/modules/pairwise/pairwise.py", line 291, in heatmap_triangle cb = pl.colorbar(caxes, ax=axes, orientation='horizontal', shrink=0.5825, File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/pyplot.py", line 2109, in colorbar ret = gcf().colorbar(mappable, cax=cax, ax=ax, **kw) File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/figure.py", line 1210, in colorbar cb = cbar.Colorbar(cax, mappable, **cb_kw) File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/colorbar.py", line 483, in __init__ self._reset_locator_formatter_scale() File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/colorbar.py", line 1206, in _reset_locator_formatter_scale self._process_values() File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/colorbar.py", line 1140, in _process_values self.norm.vmin, self.norm.vmax = mtransforms.nonsingular( File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/colors.py", line 1150, in vmin self._changed() File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/colors.py", line 1178, in _changed self.callbacks.process('changed') File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/cbook/__init__.py", line 292, in process self.exception_handler(exc) File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/cbook/__init__.py", line 96, in _exception_printer raise exc File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/cbook/__init__.py", line 287, in process func(*args, **kwargs) File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/cm.py", line 618, in changed self.callbacks.process('changed', self) File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/cbook/__init__.py", line 292, in process self.exception_handler(exc) File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/cbook/__init__.py", line 96, in _exception_printer raise exc File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/cbook/__init__.py", line 287, in process func(*args, **kwargs) File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/colorbar.py", line 551, in update_normal self.draw_all() File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/colorbar.py", line 608, in draw_all self._add_solids(X, Y, self._values[ind, np.newaxis]) File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/colorbar.py", line 624, in _add_solids self.solids = self.ax.pcolormesh( File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/__init__.py", line 1412, in inner return func(ax, *map(sanitize_sequence, args), **kwargs) File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/axes/_axes.py", line 6058, in pcolormesh X, Y, C, shading = self._pcolorargs('pcolormesh', *args, File "/lsc/easybuild/software/matplotlib/3.5.2-foss-2022a/lib/python3.10/site-packages/matplotlib/axes/_axes.py", line 5533, in _pcolorargs raise ValueError( ValueError: x and y arguments to pcolormesh cannot have non-finite values or be of type numpy.ma.core.MaskedArray with masked values

Not a big deal for me as long as I have the matrix, but I would be curious to know the true reason, why this does not work.

Thanks!
Best,
Ieva

@ievarau
Copy link
Author

ievarau commented Jan 26, 2024

And one additional comment. When Jaccard statistic is equal to 0, in the heatmap it appears as white. Even though the palette is going from dark blue to dark red with white representing 0.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant