On Sep 10, 2010, at 5:27 AM, Nils Wagner wrote:

> Hi all,
> 
> what is needed to save a figure when the size is given in 
> pixels, i.e. 1024x772 ?
> The default is 800x600 pixels.
> 
> from pylab import plot, savefig
> from numpy import sin,linspace,pi
> x = linspace(0,2*pi,200)
> plot(x,sin(x))
> savefig('test')
> 
> Nils

You can try creating a figure with the correct aspect ratio and then setting a 
corresponding dpi when you save:

#---
import matplotlib.pyplot as plt
import numpy as np

plt.figure(figsize=(10.24, 7.72))
x = np.linspace(0,2*np.pi,200)
plt.plot(x, np.sin(x))
plt.savefig('test', dpi=100)
#---

I had mixed results with this: I would occasionally get figures that were one 
pixel smaller than desired.

Best,
-Tony
------------------------------------------------------------------------------
Automate Storage Tiering Simply
Optimize IT performance and efficiency through flexible, powerful, 
automated storage tiering capabilities. View this brief to learn how
you can reduce costs and improve performance. 
http://p.sf.net/sfu/dell-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to