remove white area around

I found this question asked other times, but trying myself there is no
way that I get something working..

So I just want to generate a pdf from a plot with the smallest possible
margin, and I was trying for example this:

    fig = plt.figure(1)
    fig.frameon = False
    plt.plot(range(10), range(10))
    plt.savefig('prova1.pdf')

But the margin is still all there..
Am I missing something?

Thanks,
Andrea

Try this:

ax = gca() # get the current axes

fill the whole figure area from (0,0) to (1,1)

units are in proportion to the figure

ax.set_position((0,0,1,1))

···

On Mon, Jun 13, 2011 at 8:37 AM, Andrea Crotti <andrea.crotti.0@…287…> wrote:

I found this question asked other times, but trying myself there is no

way that I get something working…

So I just want to generate a pdf from a plot with the smallest possible

margin, and I was trying for example this:

fig = plt.figure(1)

fig.frameon = False

plt.plot(range(10), range(10))

plt.savefig('prova1.pdf')

But the margin is still all there…

Am I missing something?