SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Ken S. <kts...@gm...> - 2009年03月31日 05:44:25
Is it possible to control (actually remove) the amount of white space
padded to a figure when saving to a file? For example, the white
border found on the output of something like the following:
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
fig = plt.figure()
ax = fig.add_subplot(111,frameon=False)
ax.add_artist(mpatches.Rectangle((0,0), 1, 1, fc='gray', ec='r'))
ax.set_xticks([])
ax.set_yticks([])
ax.set_xbound([0,1])
ax.set_ybound([0,1])
fig.set_size_inches(3,3)
fig.savefig("test.eps")
From: Jouni K. S. <jk...@ik...> - 2009年03月31日 06:16:33
Ken Schutte <kts...@gm...> writes:
> Is it possible to control (actually remove) the amount of white space
> padded to a figure when saving to a file? For example, the white
> border found on the output of something like the following:
[...]
> ax = fig.add_subplot(111,frameon=False)
Use fig.add_axes([0,0,1,1],frameon=False) instead - add_subplot reserves
some space for a title, axis labels, etc.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Ken S. <kts...@gm...> - 2009年03月31日 06:34:24
On Tue, Mar 31, 2009 at 2:16 AM, Jouni K. Seppänen <jk...@ik...> wrote:
> Use fig.add_axes([0,0,1,1],frameon=False) instead - add_subplot reserves
> some space for a title, axis labels, etc.
>
Great, that works. I have noticed that when I use ticks and labels,
the border sometimes cuts things off (for small images or large text).
 But, I can just adjust the axes position for now.
thanks,
Ken
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /