question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to increase the size and save the plot of image_plot() function

See original GitHub issue

❓ Questions and Help

Although I changed the width, the size of the plot is very small (width > 20 will not increase the plot anymore).

Also, as this function return None, how can I save the plot?

Thank you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
giangnguyen2412commented, Oct 7, 2020

Thank you. Its my bad. I was posting to the wrong place! Sorry for it!

0reactions
bilalsalcommented, Oct 7, 2020

Hi @giangnguyen2412 ,

it seems the SHAP authors are using the width parameter as an upper limit on the figure size: https://github.com/slundberg/shap/blob/491d46a540d16fb5a9868de6be2913599c850167/shap/plots/_image.py#L76

Based on the above code, if the computed shap_values need less space than the value specified (e.g. 20), the figure will be smaller. You can discuss your case with the SHAP authors by creating an issue in https://github.com/slundberg/shap/issues

We are planning to support the Kernel SHAP in Captum soon (see issue #467), you will learn about this in the release notes.

Hope this helps

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to increase the size and save the plot of image_plot ...
Although I changed the width, the size of the plot is very small (width > 20 will not increase the plot anymore). Also,...
Read more >
Save plot to image file instead of displaying it using Matplotlib
import matplotlib.pyplot as plt fig = plt.figure(figsize=(4, 5)) # size in inches # use plot(), etc. to create your plot. # Pick one...
Read more >
Save Plot as Image with Matplotlib - Stack Abuse
In this tutorial, we'll go over examples of how to save a plot as an image using Matplotlib. We'll also customize it by...
Read more >
Change plot size in Matplotlib - Python - GeeksforGeeks
Here are various ways to change the default plot size as per our required dimensions or resize a given plot. Method 1: Using...
Read more >
Saving a Plot in R - DataMentor
It is important to know that plots can be saved as bitmap image (raster) which are fixed size or as vector image which...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found