davidwhogg / TheThresher

we Don't Throw Away Data (tm).
GNU General Public License v2.0
12 stars 5 forks source link

One more crash on plot with "minvalue must be less than or equal to maxvalue" #85

Open ibobak opened 4 years ago

ibobak commented 4 years ago

I saw this post https://github.com/davidwhogg/TheThresher/issues/28 but in my case the crash still has place, and it looks like I know under what conditions it happens.

I have almost all shap_values equal to 0 and some of them equal to a negative value: I attached this file here:

shap_summary_test_150000095_gm_test.png.csv.gz

After that this code

fig, ax = plt.subplots(1, 1)
shap.summary_plot(a_shap_values, a_pdf_with_features_only, plot_size=(15, 8), show=False)
ax.set_title(a_title)
plt.tight_layout()
fig.savefig(a_file_to_save)

crashes with

  File "C:\Anaconda3\lib\site-packages\matplotlib\figure.py", line 2180, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "C:\Anaconda3\lib\site-packages\matplotlib\backend_bases.py", line 2082, in print_figure
    **kwargs)
  File "C:\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py", line 527, in print_png
    FigureCanvasAgg.draw(self)
  File "C:\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py", line 388, in draw
    self.figure.draw(self.renderer)
  File "C:\Anaconda3\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "C:\Anaconda3\lib\site-packages\matplotlib\figure.py", line 1709, in draw
    renderer, self, artists, self.suppressComposite)
  File "C:\Anaconda3\lib\site-packages\matplotlib\image.py", line 135, in _draw_list_compositing_images
    a.draw(renderer)
  File "C:\Anaconda3\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "C:\Anaconda3\lib\site-packages\matplotlib\axes\_base.py", line 2647, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File "C:\Anaconda3\lib\site-packages\matplotlib\image.py", line 135, in _draw_list_compositing_images
    a.draw(renderer)
  File "C:\Anaconda3\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "C:\Anaconda3\lib\site-packages\matplotlib\collections.py", line 866, in draw
    Collection.draw(self, renderer)
  File "C:\Anaconda3\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "C:\Anaconda3\lib\site-packages\matplotlib\collections.py", line 255, in draw
    self.update_scalarmappable()
  File "C:\Anaconda3\lib\site-packages\matplotlib\collections.py", line 763, in update_scalarmappable
    self._facecolors = self.to_rgba(self._A, self._alpha)
  File "C:\Anaconda3\lib\site-packages\matplotlib\cm.py", line 289, in to_rgba
    x = self.norm(x)
  File "C:\Anaconda3\lib\site-packages\matplotlib\colors.py", line 964, in __call__
    raise ValueError("minvalue must be less than or equal to maxvalue")
ValueError: minvalue must be less than or equal to maxvalue
yanyyyy3 commented 4 years ago

It happened to me as well. But the error went away if I decreased max_displace value.