As one of who never used Sage, I don't think I'll be any help here.
Anyhow, can you tell us what kind of backed is used by default in the
two environment? I mean the type of the canvas that is initially
created.

It seems to be some dpi issue, but MPL supposed to handle this correctly.
I guess it also works fine if the figure is initially created with the
matching dpi as the savefig (72),?

Regards,

-JJ


On Thu, Oct 1, 2009 at 12:26 PM,  <jason-s...@creativetrax.com> wrote:
> Hi everyone,
>
> We're having a problem in Sage where if we specify the dpi of a figure, the
> bottom of the figure is cut off, but only the first time we save it.  If we
> save the figure again, with the same arguments, the resulting image looks
> fine.  I'm puzzled whether this is a Sage problem or a problem with
> interfacing with matplotlib, since it only happens when we are launch Sage
> (as opposed to just launching the ipython that Sage uses).
>
> More details:
>
> Running the following code in the Sage notebook or from the Sage command
> line gives a figure in which the bottom is cut off and the file is 12K
> instead of 13K.  While firefox displays an image in which the bottom is cut
> off, eog (the gnome image viewer) doesn't even display the image, so I think
> the image might be corrupted.  When I open the image with Konqueror, it
> seems like the cut off part of the image (about the lower quarter of the
> image) is completely transparent.  I've attached the cut off image.
>
> import matplotlib.pyplot as plt
> import numpy
> plt.figure()
> plt.plot(numpy.arange(0,1.1,0.01))
> plt.savefig('foo.png',dpi=72)
>
>
> However, if we immediately save the figure again:
>
> plt.savefig('foo.png',dpi=72)
>
> the resulting image looks fine (i.e., the bottom is not cut off, the file is
> 13K, and eog displays it).
>
>
> If we run the same code again using "sage -ipython" (which just launches
> Sage's ipython, without any Sage initialization), the same code:
>
> import matplotlib.pyplot as plt
> import numpy
> plt.figure()
> plt.plot(numpy.arange(0,1.1,0.01))
> plt.savefig('foo.png',dpi=72)
> works just fine (i.e., the file is correct and complete).
>
> I'm puzzled since we are just using matplotlib commands, not any Sage
> commands.  If we remove the "dpi=72" argument from savefig, everything works
> perfectly in all cases.  My guess is that there is some sort of
> configuration option that Sage is setting when it starts up, but that is
> overridden or something after the first time matplotlib saves a figure.  But
> I have no clue what sort of thing to look for.  Does anyone have an idea of
> what could be causing this issue?
>
> Thanks,
>
> Jason
>
> --
> Jason Grout
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to