I can reproduce this bug with the current svn.

It works correctly If you set dpi=72, but it seems that it would not
be an option in your case.

It seems to me that this is related with the change in r6847 that Michael made.

http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/matplotlib/backends/backend_ps.py?r1=6734&r2=6847

At line 431 of the backend_ps.py,

             clip = (0.0, 0.0, self.width * self.imagedpi,
                             self.height * self.imagedpi)

I think we should use the dpi of the figure, instead of the imagedpi
of the renderer.
Replacing self.imagedpi with 72 (which is the dpi of the figure when
ps backend is used) seems to solve the problem.

Thomas, I don't see any easy workaround for this bug other than
patching the code. Others may have better insight though.

Regards,

-JJ



On Tue, Apr 21, 2009 at 9:59 AM, Thomas Robitaille
<thomas.robitai...@gmail.com> wrote:
> Hi,
>
> I've come across a bug with the savefig method when using the dpi=
> argument and saving an EPS file. If you try the following code, you
> will see that the frame is incomplete. Is there a way to solve this
> from a user point of view?
>
> ---
>
> import matplotlib
> matplotlib.use('Agg')
> from matplotlib.pyplot import *
>
> import numpy as np
>
> nx,ny = 10,10
>
> image = np.random.random((nx,ny))
>
> fig = figure(figsize=(4,4))
> ax = fig.add_subplot(111)
> ax.imshow(image,interpolation='nearest')
> fig.savefig('plot.eps',dpi=30)
>
> ---
>
> I've submitted a bug report:
>
> https://sourceforge.net/tracker/?func=detail&aid=2777476&group_id=80706&atid=560720
>
> Thanks,
>
> Thomas
>
> ------------------------------------------------------------------------------
> Stay on top of everything new and different, both inside and
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today.
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to