Re: [Matplotlib-users] zorder seems to cause problems when embed python in latex files

2008-10-14 Thread Jouni K . Seppänen
[EMAIL PROTECTED] writes:

 I also attached the final PDF since you asked for it.

You didn't mention your matplotlib version, but the embedded pdf file
seems to come from matplotlib 0.91.2. That version had a bug where the
graphics context was not always restored properly, which could very well
be the cause of your problem:

  2008-03-23 Fix a pdf backend bug which sometimes caused the outermost
 gsave to not be balanced with a grestore. - JKS
...
  2008-01-06 Released 0.91.2 at revision 4802

Can you upgrade to 0.91.4?

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] zorder seems to cause problems when embed python in latex files

2008-10-14 Thread chris
On Tue, Oct 14, 2008 at 03:00:05PM -0400, Michael Droettboom wrote:
 With the file you sent, I can see the messed up footer in xpdf, but not
 in acroread.  There are a number of times that I have seen xpdf not
 completely support the PDF spec, and this may be one of them.

I installed acroread and I was also able to view everything fine with it
whereas xpdf and evince showed the bug.


 Creating my own files, however, I'm not able to reproduce this here.

Hmmm.  This would imply that your versions somehow do something that makes xpdf
happy.

 When I compile your test.tex, I get an error, even though it seems to
 have loaded the python.sty file.  Not sure why (see attached log).

Looks like it doesn't know what \begin{python} means.  Did you put python.sty
in the same directory as text.tex?

 When I generate the plots offline, and then hack test.tex to simply
 include the files, everything works fine, and I don't see a problem with
 the footers with either xpdf or acroread.

I see the problem with xpdf when I simply include the plots which means that
python.sty was just a red herring.  python.sty isn't the problem.

 There was a recent bug discovered in matplotlib where PDF files weren't
 always getting flushed completely.  I don't *think* that's the cause of
 this, but if you could reproduce what I did (generate the plots
 independently of TeX and then load them), and that works for you, that
 might point to something like that.

xpdf still croaks for me.  Perhaps using the bleeding edge of matplotlib would
fix?  I'm using Ubuntu 8.04 which has python-matplotlib version
0.91.2-0ubuntu1.

 There was also a bug a few months back where xpdf didn't like the way
 matplotlib handled reusing the same graphic multiple times (which is
 used for markers).  That may be why you're seeing the footer bug and I'm
 not -- you didn't mention which version of matplotlib you're running, so
 it's hard to say.

 Here's my versions of all the various moving pieces:
 pdfTeX (Web2C 7.4.5) 3.14159-1.10b
 kpathsea version 3.4.5
 Copyright (C) 1997-2003 Han The Thanh.
 Beamer 3.00
 python 2.5.2
 matplotlib SVN (today)
 Acroread 8.1.1
 xpdf 3.00

Here is what I got:

Beamer 3.07-1
python 2.5.2
matplotlib  0.91.2-0ubuntu1
Acroread 8.1.2_SU1
xpdf 3.02-1.3ubuntu1

Ironically, all my stuff is newer than yours except for matplotlib.  Sounds
like bleeding edge of matplotlib must be tried next.

 That python.sty stuff looks really cool, by the way.  I haven't come
 across it before.

Glad I could help!

cs

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] zorder seems to cause problems when embed python in latex files

2008-10-14 Thread Jouni K . Seppänen
Jouni K. Seppänen [EMAIL PROTECTED] writes:

   2008-03-23 Fix a pdf backend bug which sometimes caused the outermost
  gsave to not be balanced with a grestore. - JKS

 Can you upgrade to 0.91.4?

Here's the relevant patch, in case applying it is more convenient than
upgrading:

Index: lib/matplotlib/backends/backend_pdf.py
===
--- lib/matplotlib/backends/backend_pdf.py	(revision 5017)
+++ lib/matplotlib/backends/backend_pdf.py	(revision 5018)
@@ -1159,7 +1159,7 @@
 self.tex_font_map = None
 
 def finalize(self):
-self.gc.finalize()
+self.file.output(*self.gc.finalize())
 
 def check_gc(self, gc, fillcolor=None):
 orig_fill = gc._fillcolor

-- 
Jouni K. Seppänen
http://www.iki.fi/jks
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] zorder seems to cause problems when embed python in latex files

2008-10-14 Thread Michael Droettboom
[EMAIL PROTECTED] wrote:
 LaTeX can accept embedded Python code with a python.sty file.

 This is handy to dynamically generate plots with Matplotlib for a LaTeX slide
 presentation.

 I successfully embedded lots of matplotlib plot code into my slides
 and then had problems with zorder.

 For some reason zorder seems to mess up the footer of my Beamer/LaTeX slides.
 (For some reason zorder setting make the footer shrink in size.)

 Is there any weirdness or side effects about zorder I should be aware of that
 would explain this?
   
My best guess is that when the elements of the plot are in a particular 
order, the last drawn element has some setting that is not getting 
reverted back when going back to the LaTeX part of the slide.  In 
general, matplotlib doesn't explicitly try to be careful about state in 
its output since it is really the embedding applications job (in this 
case Beamer/LaTeX) that is supposed to ensure that anything it embeds 
does not have external side effects.

But I've never tried this combination of python.sty/Beamer/LaTeX 
personally.  Can you send us the output of your plot on its own (ps or 
pdf...)?

Mike

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] zorder seems to cause problems when embed python in latex files

2008-10-13 Thread chris
LaTeX can accept embedded Python code with a python.sty file.

This is handy to dynamically generate plots with Matplotlib for a LaTeX slide
presentation.

I successfully embedded lots of matplotlib plot code into my slides
and then had problems with zorder.

For some reason zorder seems to mess up the footer of my Beamer/LaTeX slides.
(For some reason zorder setting make the footer shrink in size.)

Is there any weirdness or side effects about zorder I should be aware of that
would explain this?

Chris

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users