Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your original plot must have whitespace around it, otherwise bbox_inches=tight would not remove any of the area. There are two solutions to this that I know of:</p> <ol> <li><p>The simple method is to use <code>tight_layout</code> as mentioned by tcaswell.</p></li> <li><p>The more complicated, but more controllable method is to avoid using <code>fig.add_subplot(111)</code> and instead use <code>fig.add_axes()</code> which allows you to be much more strict in terms of how large your axes are when you define the axes instance. You can then tweak the size of your axes to take up as much of the figure area as required to maintain a 5" figure area. Once you have done this, I would recommend simply not using <code>bbox_inches</code> or set it to None (the default) to avoid unnessicary cropping. <code>fig.add_axes()</code> requires a <code>rect</code> parameter as its first argument which consists of <code>[left_position, bottom_position, width, height]</code> each of which range from 0 to 1.</p></li> </ol> <p>Edit: After going through the <code>tight_layout</code> tutorial again, I have realized that it covers pretty much everything. I hadn't realized that it was able to maintain the aspect ratio of the axes instance easily, even if the aspect ratio of the figure is different from that of the axes instance. I tend to try to be very explicit when I define my axes areas because I deal with satellite imagery and try to keep it as the native sensor resolution or some factor of that sensor resolution, which requires a little bit more control.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload