SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S



1
(8)
2
(11)
3
(4)
4
(6)
5
(13)
6
(30)
7
(21)
8
(9)
9
(19)
10
(4)
11
(5)
12
(14)
13
(19)
14
(22)
15
(12)
16
(15)
17
(14)
18
(1)
19
(1)
20
(11)
21
(9)
22
(18)
23
(39)
24
(12)
25
(7)
26
(13)
27
(18)
28
(3)
29
(5)
30
(12)
31
(10)

Showing 22 results of 22

From: Mathew Y. <my...@jp...> - 2008年10月14日 23:39:33
I had a bug in my code, when I fixed it I can now see the lines.
If there is a better way to do what I'm doing, and love to hear it.
Mathew Yeates wrote:
> Any help appreciated
>
> I am displaying a line on a map ala
> --------------
> m=Basemap( .... )
> xpt,ypt= m([],[])
> outlines=m.plot(xpt,ypt,'r-')
> -----------------
> and then in an update routine I do
>
> ----------------
> def update(newxpts,newypts):
> outlines[0].set_data(newxpst,newypts)
> -----------------------
>
> This works fine but now I want to add additional lines. I tried
>
> --------------------
> m=Basemap( .... )
> xpt,ypt= m([],[])
> outlines=m.plot(xpt,ypt,'r-')
> slitlines=[]
> for i in range(0,500):
> slitlines.append(m.plot([],[],'b-'))
> ------------------------
>
> and
>
> ------------------------
> def update(newxpts,newypts,newslitx,newlity):
> outlines[0].set_data(newxpst,newypts)
> for i in 
> range(0,500):slitlines[i][0].set_data([startx[i],endx[i]],[starty[i],endy[i]])
> -------------------------
>
> but this doesn't work. Clearly I'm doing something wrong.
> Whats the best way to do this?
>
> Thanks
> Mathew
> 
>
>
> 
> 
> 
>
>
>
> -------------------------------------------------------------------------
> 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=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> 
From: Eric F. <ef...@ha...> - 2008年10月14日 22:57:07
John Hunter wrote:
> On Tue, Oct 14, 2008 at 2:58 PM, Eric Firing <ef...@ha...> wrote:
>> mask = (PyArrayObject *)PyArray_SimpleNew(1,dimensions,PyArray_INT);
>>
>> in nxutils.cpp would become
>>
>> mask = (PyArrayObject *)PyArray_SimpleNew(1,dimensions, NPY_BOOL);
>>
>> Can anyone think of anything this would break, or any disadvantages?
> 
> This looks better to me too - -I suggest testing it with the lasso
> demo which was the example that motivated this code.
> 
> JDH
It worked, so I went ahead and committed the change. I had to change 
one other line, and while in the neighborhood I replaced the other 
old-form PyArray_* with NPY_*.
Eric
From: Mathew Y. <my...@jp...> - 2008年10月14日 22:45:09
Any help appreciated
I am displaying a line on a map ala
--------------
m=Basemap( .... )
xpt,ypt= m([],[])
outlines=m.plot(xpt,ypt,'r-')
-----------------
and then in an update routine I do
----------------
def update(newxpts,newypts):
 outlines[0].set_data(newxpst,newypts)
-----------------------
This works fine but now I want to add additional lines. I tried
--------------------
m=Basemap( .... )
xpt,ypt= m([],[])
outlines=m.plot(xpt,ypt,'r-')
slitlines=[]
for i in range(0,500):
 slitlines.append(m.plot([],[],'b-'))
------------------------
and
------------------------
def update(newxpts,newypts,newslitx,newlity):
 outlines[0].set_data(newxpst,newypts)
 for i in 
range(0,500):slitlines[i][0].set_data([startx[i],endx[i]],[starty[i],endy[i]])
-------------------------
but this doesn't work. Clearly I'm doing something wrong.
Whats the best way to do this?
Thanks
Mathew
 
 
 
 
On Tue, Oct 14, 2008 at 11:21:58PM +0300, Jouni K. Sepp?nen wrote:
> Jouni K. Sepp?nen <jk...@ik...> 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
thanks! you 1 line change appears to fix all!
cs
From: Jouni K. S. <jk...@ik...> - 2008年10月14日 20:25:19
Jouni K. Seppänen <jk...@ik...> 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:
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
From: John H. <jd...@gm...> - 2008年10月14日 20:18:21
On Tue, Oct 14, 2008 at 2:58 PM, Eric Firing <ef...@ha...> wrote:
> mask = (PyArrayObject *)PyArray_SimpleNew(1,dimensions,PyArray_INT);
>
> in nxutils.cpp would become
>
> mask = (PyArrayObject *)PyArray_SimpleNew(1,dimensions, NPY_BOOL);
>
> Can anyone think of anything this would break, or any disadvantages?
This looks better to me too - -I suggest testing it with the lasso
demo which was the example that motivated this code.
JDH
From: Jouni K. S. <jk...@ik...> - 2008年10月14日 20:17:32
ch...@se... 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
From: Eric F. <ef...@ha...> - 2008年10月14日 19:59:07
Pierre GM wrote:
> Mathew,
> Have you tried the solution that was suggested by Angus yesterday on the numpy 
> mailing list ?
> 
> http://projects.scipy.org/pipermail/scipy-user/2008-February/015418.html
> 
>>>> import numpy as np
>>>> import matplotlib.nxutils as nxutils
>>>> polygon=np.array([(0,0),(0,1),(1,1),(1,0)])
>>>> points = np.array([(0.5,0.5),(0.4,1.5)])
>>>> nxutils.points_inside_poly(points, polygon)
> array([1, 0], dtype=int32)
> 
> Meaning that the first point is, the second is not.
It seems to me that the output should be boolean, so the line
 mask = (PyArrayObject *)PyArray_SimpleNew(1,dimensions,PyArray_INT);
in nxutils.cpp would become
 mask = (PyArrayObject *)PyArray_SimpleNew(1,dimensions, NPY_BOOL);
Can anyone think of anything this would break, or any disadvantages?
Eric
From: Mathew Y. <my...@jp...> - 2008年10月14日 19:33:23
Angus originally suggest matplotlib. The other proposed solutions are 
overkill, unless it turns out that performance is a problem
Thanks
Mathew
Pierre GM wrote:
> Mathew,
> Have you tried the solution that was suggested by Angus yesterday on the numpy 
> mailing list ?
>
> http://projects.scipy.org/pipermail/scipy-user/2008-February/015418.html
>
> 
>>>> import numpy as np
>>>> import matplotlib.nxutils as nxutils
>>>> polygon=np.array([(0,0),(0,1),(1,1),(1,0)])
>>>> points = np.array([(0.5,0.5),(0.4,1.5)])
>>>> nxutils.points_inside_poly(points, polygon)
>>>> 
> array([1, 0], dtype=int32)
>
> Meaning that the first point is, the second is not.
>
> -------------------------------------------------------------------------
> 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=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> 
From: Mathew Y. <my...@jp...> - 2008年10月14日 19:32:06
Thanks! Thats exactly what I was looking for!
Mathew
Michael Droettboom wrote:
> If you can convert your polygon to a path, you can use the 
> "contains_point" method:
>
> >>> from matplotlib import path
> >>> p = path.Path([[0,0], [42, 3], [45, 23], [1, 32]])
> >>> p.contains_point([5,5])
> 1
> >>> p.contains_point([72, 3])
> 0
>
> Mike
>
> Mathew Yeates wrote:
>> Is there a routine in matplotlib for telling whether a point is 
>> inside a convex 4 sided polygon?
>>
>> Mathew
>>
>>
>>
>> ------------------------------------------------------------------------- 
>>
>> 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=100&url=/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> 
>
From: Pierre GM <pgm...@gm...> - 2008年10月14日 19:14:19
Mathew,
Have you tried the solution that was suggested by Angus yesterday on the numpy 
mailing list ?
http://projects.scipy.org/pipermail/scipy-user/2008-February/015418.html
>>> import numpy as np
>>> import matplotlib.nxutils as nxutils
>>> polygon=np.array([(0,0),(0,1),(1,1),(1,0)])
>>> points = np.array([(0.5,0.5),(0.4,1.5)])
>>> nxutils.points_inside_poly(points, polygon)
array([1, 0], dtype=int32)
Meaning that the first point is, the second is not.
From: Michael D. <md...@st...> - 2008年10月14日 19:02:59
If you can convert your polygon to a path, you can use the 
"contains_point" method:
 >>> from matplotlib import path
 >>> p = path.Path([[0,0], [42, 3], [45, 23], [1, 32]])
 >>> p.contains_point([5,5])
1
 >>> p.contains_point([72, 3])
0
Mike
Mathew Yeates wrote:
> Is there a routine in matplotlib for telling whether a point is inside a 
> convex 4 sided polygon?
>
> Mathew
>
>
>
> -------------------------------------------------------------------------
> 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=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Michael D. <md...@st...> - 2008年10月14日 19:00:15
Attachments: test.broken.log test.tex
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.
Creating my own files, however, I'm not able to reproduce this here.
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).
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.
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. 
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
That python.sty stuff looks really cool, by the way. I haven't come 
across it before.
Mike
ch...@se... wrote:
> On Tue, Oct 14, 2008 at 08:21:08AM -0400, Michael Droettboom wrote:
> 
>> 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
>
> Wow thanks. I was afraid no one would respond. I suppose if Matplotlib is so
> mature that we are left worrying about bugs when embedding it in Latex then it
> has come a long way. :)
>
> I created a tiny test.tex that shows the problem. Just type
>
> pdflatex -shell-escape test.tex ; xpdf test.pdf
>
> in the same directory with the 2 files test.tex and python.sty below and
> attached. I also attached the final PDF since you asked for it.
>
> \documentclass{beamer}
> \usepackage{beamerthemesplit}
> \usepackage{graphicx}
> \usepackage{python}
> \begin{document}
> \title[Example of zorder trouble]{Example of zorder trouble}
> \author[Matplotlib fan]{Matplotlib fan}
> \date{}
> \setbeamertemplate{navigation symbols}{}
> \frame{\titlepage}
>
> \begin{frame}[fragile]\frametitle{No zorder - notice footer ok}
> \begin{python}
> import pylab
> pylab.plot(range(10), range(10))
> pylab.scatter([5], [5])
> pylab.savefig('plot1.pdf')
> print r'\includegraphics[width=200pt]{plot1.pdf}'
> \end{python}
> \end{frame}
>
> \begin{frame}[fragile]\frametitle{zorder - notice footer messed up}
> \begin{python}
> import pylab
> pylab.plot(range(10), range(10), zorder = 1)
> pylab.scatter([5], [5], zorder = 9)
> pylab.savefig('plot2.pdf')
> print r'\includegraphics[width=200pt]{plot2.pdf}'
> \end{python}
> \end{frame}
>
> \end{document}
>
>
>
>
>
>
> %% This program is free software; you can redistribute it and/or
> %% modify it under the terms of the GNU General Public License
> %% as published by the Free Software Foundation; either version 2
> %% of the License, or (at your option) any later version.
> %%
> %% This program is distributed in the hope that it will be useful,
> %% but WITHOUT ANY WARRANTY; without even the implied warranty of
> %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> %% GNU General Public License for more details.
> %%
> %% You should have received a copy of the GNU General Public License
> %% along with this program; if not, write to the Free Software
> %% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
> %%
> %% Author: Martin R. Ehmsen, eh...@im....
> %% Department of Mathematics and Computer Science,
> %% University of Southern Denmark, DK
> %%
> %% You can find an online copy of the GPL at
> %% http://www.gnu.org/copyleft/gpl.html .
> %%
> %% Note: shell-escape needs to be activated for this to work.
> %% This can either be done by passing -shell-escape as an option to
> %% latex or by adding/changing "shell_escape = t" in your texmf.cnf .
>
> % 0.2 -> 0.21: Moved \newwrite\@module from \@writemodule and out, since
> % no more than 15 \newwrites are allowed (and the previous version created a new
> % every time \@writemodule was called.
>
> \NeedsTeXFormat{LaTeX2e}[1994年12月01日]
> \ProvidesPackage{python}[2007年06月07日 v0.21 Python in LaTeX]
>
> \newwrite\@out
> \newwrite\@module
>
> \begingroup \catcode `|=0 \catcode `[=1
> \catcode`]=2 \catcode `\{=12 \catcode `\}=12
> \catcode`\\=12 |gdef|@xpython#1\end{python}[|immediate|write|@out[#1]|end[python]]
> |endgroup
>
> \def\python{\kernel@ifnextchar [{\@python}{\@python[]}}
>
> \def\@python[#1]{%
> \gdef\@pythoninclude{#1}
> \immediate\openout\@out=\jobname.py
> \newlinechar='15
> \begingroup \catcode`\^^M=12 %
> \let\do\@makeother\dospecials\obeyspaces%
> \@xpython}
>
> \def\endpython{%
> \endgroup
> \immediate\closeout\@out
> \@writemodule
> \immediate\write18{cat \@pythoninclude\space\jobname.py | python > \jobname.py.out 2> \jobname.py.err}
> \immediate\input\jobname.py.out}
> %\immediate\write{\begin{verbatim}}
> %\immediate\input\jobname.py.err
> %\immediate\write{\end{verbatim}}}
>
> \def\@writemodule{%
> \immediate\openout\@module=latex.py
> \immediate\write\@module{jobname="\jobname"}
> \immediate\closeout\@module}
>
> % BUGS:
> % 1. If anything gets send to stderr then it should be included
> % in \begin{verbatim}...\end{verbatim} to be properly displayed
> %
> % \immediate\write18{cat \@pythoninclude\space\jobname.py | python > \jobname.py.out 2>\jobname.py.err}
> %
> % 2. Watch out for indentation done by aucTeX in Emacs
> %
> % 3. Let the package accept a "final version" option, such
> % that the output of each python run is saved such that it can be
> % inserted into the document by hand
> % (conference, journals are not likely to compile with
> % shell_escape or have python).
> %
> % \gdef\@prepython{}
> % \def\prepython#1{%
> % \gdef\@prepython{#1}
> % }
> % sed -e 's/^ //g' cluster.py
> % \immediate\write18{\@prepython\space\jobname.py > \
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Mathew Y. <my...@jp...> - 2008年10月14日 18:47:53
Is there a routine in matplotlib for telling whether a point is inside a 
convex 4 sided polygon?
Mathew
On Tue, Oct 14, 2008 at 08:21:08AM -0400, Michael Droettboom wrote:
> 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
Wow thanks. I was afraid no one would respond. I suppose if Matplotlib is so
mature that we are left worrying about bugs when embedding it in Latex then it
has come a long way. :)
I created a tiny test.tex that shows the problem. Just type
pdflatex -shell-escape test.tex ; xpdf test.pdf
in the same directory with the 2 files test.tex and python.sty below and
attached. I also attached the final PDF since you asked for it.
\documentclass{beamer}
\usepackage{beamerthemesplit}
\usepackage{graphicx}
\usepackage{python}
\begin{document}
\title[Example of zorder trouble]{Example of zorder trouble}
\author[Matplotlib fan]{Matplotlib fan}
\date{}
\setbeamertemplate{navigation symbols}{}
\frame{\titlepage}
\begin{frame}[fragile]\frametitle{No zorder - notice footer ok}
\begin{python}
import pylab
pylab.plot(range(10), range(10))
pylab.scatter([5], [5])
pylab.savefig('plot1.pdf')
print r'\includegraphics[width=200pt]{plot1.pdf}'
\end{python}
\end{frame}
\begin{frame}[fragile]\frametitle{zorder - notice footer messed up}
\begin{python}
import pylab
pylab.plot(range(10), range(10), zorder = 1)
pylab.scatter([5], [5], zorder = 9)
pylab.savefig('plot2.pdf')
print r'\includegraphics[width=200pt]{plot2.pdf}'
\end{python}
\end{frame}
\end{document}
%% This program is free software; you can redistribute it and/or
%% modify it under the terms of the GNU General Public License
%% as published by the Free Software Foundation; either version 2
%% of the License, or (at your option) any later version.
%%
%% This program is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
%% GNU General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with this program; if not, write to the Free Software
%% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
%%
%% Author: Martin R. Ehmsen, eh...@im....
%% Department of Mathematics and Computer Science,
%% University of Southern Denmark, DK
%%
%% You can find an online copy of the GPL at
%% http://www.gnu.org/copyleft/gpl.html .
%%
%% Note: shell-escape needs to be activated for this to work.
%% This can either be done by passing -shell-escape as an option to
%% latex or by adding/changing "shell_escape = t" in your texmf.cnf .
% 0.2 -> 0.21: Moved \newwrite\@module from \@writemodule and out, since
% no more than 15 \newwrites are allowed (and the previous version created a new
% every time \@writemodule was called.
\NeedsTeXFormat{LaTeX2e}[1994年12月01日]
\ProvidesPackage{python}[2007年06月07日 v0.21 Python in LaTeX]
\newwrite\@out
\newwrite\@module
\begingroup \catcode `|=0 \catcode `[=1
\catcode`]=2 \catcode `\{=12 \catcode `\}=12
\catcode`\\=12 |gdef|@xpython#1\end{python}[|immediate|write|@out[#1]|end[python]]
|endgroup
\def\python{\kernel@ifnextchar [{\@python}{\@python[]}}
\def\@python[#1]{%
\gdef\@pythoninclude{#1}
\immediate\openout\@out=\jobname.py
\newlinechar='15
\begingroup \catcode`\^^M=12 %
\let\do\@makeother\dospecials\obeyspaces%
\@xpython}
\def\endpython{%
\endgroup
\immediate\closeout\@out
\@writemodule
\immediate\write18{cat \@pythoninclude\space\jobname.py | python > \jobname.py.out 2> \jobname.py.err}
\immediate\input\jobname.py.out}
%\immediate\write{\begin{verbatim}}
%\immediate\input\jobname.py.err
%\immediate\write{\end{verbatim}}}
\def\@writemodule{%
\immediate\openout\@module=latex.py
\immediate\write\@module{jobname="\jobname"}
\immediate\closeout\@module}
% BUGS:
% 1. If anything gets send to stderr then it should be included
% in \begin{verbatim}...\end{verbatim} to be properly displayed
%
% \immediate\write18{cat \@pythoninclude\space\jobname.py | python > \jobname.py.out 2>\jobname.py.err}
%
% 2. Watch out for indentation done by aucTeX in Emacs
%
% 3. Let the package accept a "final version" option, such
% that the output of each python run is saved such that it can be
% inserted into the document by hand
% (conference, journals are not likely to compile with
% shell_escape or have python).
%
% \gdef\@prepython{}
% \def\prepython#1{%
% \gdef\@prepython{#1}
% }
% sed -e 's/^ //g' cluster.py
% \immediate\write18{\@prepython\space\jobname.py > \
From: Michael L. <mgl...@gm...> - 2008年10月14日 15:02:53
On Mon, Oct 13, 2008 at 3:59 PM, Eric Firing <ef...@ha...> wrote:
> Michael Lerner wrote:
>>
>> Hi,
>>
>> I'm trying to plot some data where certain values are marked by a
>> sentinel, as per the Cookbook example:
>>
>>
>> http://www.scipy.org/Cookbook/Matplotlib/Plotting_Images_with_Special_Values
>>
>> However, that code is fairly old, and doesn't work. A version that
>> worked as of ~18 months ago was posted to the list:
>>
>> http://www.nabble.com/Re:-Trying-p8831162.html
>>
>> but it fails when I try to use it with matplotlib 0.98.3 and imshow.
>> Does anyone have an updated version?
>>
>> Thanks,
>>
>> -michael
>>
>
> Michael,
>
> In the mpl "examples" directory there is a script that might be directly
> relevant:
>
> examples/pylab_examples/image_masked.py
That's fantastic. I had tried using masked arrays before. They weren't
good enough because I need three different sentinels, and at least one
with a controllable alpha value. The combination of set_over,
set_under and set_bad gives me exactly what I need. Thanks!
-michael
>
> Eric
>
-- 
Michael Lerner, Ph.D.
IRTA Postdoctoral Fellow
Laboratory of Computational Biology NIH/NHLBI
5635 Fishers Lane, Room T909, MSC 9314
Rockville, MD 20852 (UPS/FedEx/Reality)
Bethesda MD 20892-9314 (USPS)
http://www.umich.edu/~mlerner
From: John H. <jd...@gm...> - 2008年10月14日 13:20:35
On Tue, Oct 14, 2008 at 7:35 AM, Michael Droettboom <md...@st...> wrote:
> I saw this blank image problem a couple of weeks ago, and I was seeing it in
> my local doc builds as well.
>
> It appeared then that this change broke inline plots:
>
> """
> r6089 | jdh2358 | 2008年09月13日 10:28:09 -0400 (2008年9月13日) | 1 line
>
> replaced ipython run magic with code.InteractiveConsole.runsource
> """
>
> because InteractiveConsole injects a number of things in __builtin__ that
> interfere with recent SVN versions of Sphinx.
>
> """
> r6137 | mdboom | 2008年09月30日 16:07:54 -0400 (2008年9月30日) | 3 lines
>
> [ 2138392 ] API doc for add_subplot()
> Also fixing numerous problems with the documentation build. It seems that
> the change in plot_directive.py to use the "code" module to run scripts
> interferes with i18n in Sphinx (due to the overloading of '_' as a symbol).
> Changed to use the fewer-moving-parts imp.load_module() instead.
> """
>
> I changed this in SVN to just use imp.load_module instead, and this resolved
> the problem locally. I had expected the doc buildbot to pick it up and run
> with it, but I never followed up to see if it ever did. It's possible that
> this SF quota/login etc. problem has been blocking the updates all this
> time. So it's not necessarily that the files are transferring incorrectly,
> merely that they haven't been transferring at all since Sept 30 or before.
Just checked my cron emails again and indeed, the last successful
update was in mid September. I'll need to keep a closer eye on these.
Indeed, sourceforge revamped their shell services and I missed the
email. Details are here
 http://sourceforge.net/community/forum/topic.php?id=3471&page&replies=2
Short answer: there is no longer any ssh shell access but sftp and
rsync over ssh are supported. The new server is web.sf.net. I
updated my makefile and synced the docs, so
http://matplotlib.sourceforge.net/doc/html/ is live again
JDH
JDH
From: Michael D. <md...@st...> - 2008年10月14日 12:35:59
I saw this blank image problem a couple of weeks ago, and I was seeing 
it in my local doc builds as well.
It appeared then that this change broke inline plots:
"""
r6089 | jdh2358 | 2008年09月13日 10:28:09 -0400 (2008年9月13日) | 1 line
replaced ipython run magic with code.InteractiveConsole.runsource
"""
because InteractiveConsole injects a number of things in __builtin__ 
that interfere with recent SVN versions of Sphinx.
"""
r6137 | mdboom | 2008年09月30日 16:07:54 -0400 (2008年9月30日) | 3 lines
[ 2138392 ] API doc for add_subplot()
Also fixing numerous problems with the documentation build. It seems 
that the change in plot_directive.py to use the "code" module to run 
scripts interferes with i18n in Sphinx (due to the overloading of '_' as 
a symbol). Changed to use the fewer-moving-parts imp.load_module() instead.
"""
I changed this in SVN to just use imp.load_module instead, and this 
resolved the problem locally. I had expected the doc buildbot to pick 
it up and run with it, but I never followed up to see if it ever did. 
It's possible that this SF quota/login etc. problem has been blocking 
the updates all this time. So it's not necessarily that the files are 
transferring incorrectly, merely that they haven't been transferring at 
all since Sept 30 or before.
If my change doesn't fix the image problem for you or the buildbot, let 
me know and I can revert it.
Mike
John Hunter wrote:
> On Mon, Oct 13, 2008 at 6:56 PM, Eric Firing <ef...@ha...> wrote:
>
> 
>>> However, unfortunately there appears to be some problem with the
>>> generation of the figures which are supposed to be embedded within that
>>> documentation - they're all appearing as nothing but blank white spaces,
>>> both in Firefox 3.0.3 on OS X 10.5.5, and when I download the files and view
>>> them with other programs. Do other people see this problem?
>>> 
>> Yes, something is broken. I don't know how to fix it, though.
>> 
>
> It looks like either the rsync screwed up or sf is throttling us or
> both. I got this message in my cron job
>
> ssh: connect to host matplotlib.sf.net port 22: Connection refused
> rsync: connection unexpectedly closed (0 bytes received so far) [sender]
> rsync error: unexplained error (code 255) at io.c(453) [sender=2.6.9]
> ssh: connect to host matplotlib.sf.net port 22: Connection refused
> lost connection
>
> when I check the images in the
> http://matplotlib.sourceforge.net/doc/html/pyplots/ directory, they
> are there but are smaller in filesize than they are in the directory
> on the build machine, suggesting they were truncated in the transfer.
> When I try and log into the sf shell server
>
> > ssh -l jdh2358 shell.sf.net
>
> it hangs.
>
> Normally they send me an email when I am over file size quota, so I
> would be surprised if they simply throttled us w/o a warning, but I
> will file a ticket with the sf folks and see if they can help.
>
> JDH
>
> -------------------------------------------------------------------------
> 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=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Michael D. <md...@st...> - 2008年10月14日 12:21:25
ch...@se... 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
From: Michael D. <md...@st...> - 2008年10月14日 12:14:27
Can you send us some input and output that exhibits this problem, and 
some information about your versions and platform?
ch...@se... wrote:
> The plot PDFs that matplotlib makes by default seem to be too tiny to contain
> my biggest axis labels and my poor Latex stuff is chopped in half.
>
> How fix?
>
> 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=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: John H. <jd...@gm...> - 2008年10月14日 11:18:42
On Mon, Oct 13, 2008 at 6:56 PM, Eric Firing <ef...@ha...> wrote:
>> However, unfortunately there appears to be some problem with the
>> generation of the figures which are supposed to be embedded within that
>> documentation - they're all appearing as nothing but blank white spaces,
>> both in Firefox 3.0.3 on OS X 10.5.5, and when I download the files and view
>> them with other programs. Do other people see this problem?
>
> Yes, something is broken. I don't know how to fix it, though.
It looks like either the rsync screwed up or sf is throttling us or
both. I got this message in my cron job
 ssh: connect to host matplotlib.sf.net port 22: Connection refused
 rsync: connection unexpectedly closed (0 bytes received so far) [sender]
 rsync error: unexplained error (code 255) at io.c(453) [sender=2.6.9]
 ssh: connect to host matplotlib.sf.net port 22: Connection refused
 lost connection
when I check the images in the
http://matplotlib.sourceforge.net/doc/html/pyplots/ directory, they
are there but are smaller in filesize than they are in the directory
on the build machine, suggesting they were truncated in the transfer.
When I try and log into the sf shell server
 > ssh -l jdh2358 shell.sf.net
it hangs.
Normally they send me an email when I am over file size quota, so I
would be surprised if they simply throttled us w/o a warning, but I
will file a ticket with the sf folks and see if they can help.
JDH

Showing 22 results of 22

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /