[Matplotlib-users] newbie question: type check?

2010-01-11 Thread Nico Schlömer
Hi,

quick question from a Python noob:
Suppose I have an instance of an object of matplotlib, Is there any
way to check on its type, e.g., whether it is an instance of
matplotlib.axes.AxesSubplots?

Cheers!
Nico

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Save eps ghostscript error

2010-01-11 Thread Jae-Joon Lee
When you check out the svn, please try to apply the patch attached.

patch -p1 < ps_distiller.patch

I hope this solves your problem.

Regards,

-JJ


On Mon, Jan 11, 2010 at 7:25 PM, Jae-Joon Lee  wrote:
> On Mon, Jan 11, 2010 at 6:49 PM, John Reid  
> wrote:
>> Thanks for help so far. Any more ideas? I'll try the svn if it is just a
>> case of checking it out and compiling.
>>
>
> Please try.
> I don't think the current  svn version will make any difference. But,
> at least I can send you a patch that I think fix the problem so that
> you can test it.
> I'll post the patch here soon.
>
> Regards.
>
> -JJ
>
diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py
index a1366b3..9e0636a 100644
--- a/lib/matplotlib/backends/backend_ps.py
+++ b/lib/matplotlib/backends/backend_ps.py
@@ -1383,14 +1383,17 @@ def gs_distill(tmpfile, eps=False, ptype='letter', bbox=None):
 This yields smaller files without illegal encapsulated postscript
 operators. The output is low-level, converting text to outlines.
 """
-paper = '-sPAPERSIZE=%s'% ptype
+
+paper_option = "-sPAPERSIZE=%s" % ptype
+
 psfile = tmpfile + '.ps'
 outfile = tmpfile + '.output'
 dpi = rcParams['ps.distiller.res']
 if sys.platform == 'win32': gs_exe = 'gswin32c'
 else: gs_exe = 'gs'
+
 command = '%s -dBATCH -dNOPAUSE -r%d -sDEVICE=pswrite %s -sOutputFile="%s" \
-"%s" > "%s"'% (gs_exe, dpi, paper, psfile, tmpfile, outfile)
+"%s" > "%s"'% (gs_exe, dpi, paper_option, psfile, tmpfile, outfile)
 verbose.report(command, 'debug')
 exit_status = os.system(command)
 fh = file(outfile)
@@ -1404,11 +1407,11 @@ your image.\nHere is the full report generated by ghostscript:\n\n' + fh.read())
 
 
 
-# Since the the paper size is set to the figure size for eps
-# output (in '_print_figure_tex'), pstoeps call is not required.
+# The above gs run seem to modify the bbox of the original eps file.
+# Thus, it seems that we need to restore the original bbox.
 
-#if eps:
-#pstoeps(tmpfile, bbox)
+if eps:
+pstoeps(tmpfile, bbox, use_original_bbox=True)
 
 
 def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None):
@@ -1421,9 +1424,13 @@ def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None):
 pdffile = tmpfile + '.pdf'
 psfile = tmpfile + '.ps'
 outfile = tmpfile + '.output'
+
+if eps: paper_option = "-dEPSCrop"
+else: paper_option = "-sPAPERSIZE=%s" % ptype
+
 command = 'ps2pdf -dAutoFilterColorImages=false \
--sColorImageFilter=FlateEncode -sPAPERSIZE=%s "%s" "%s" > "%s"'% \
-(ptype, tmpfile, pdffile, outfile)
+-sColorImageFilter=FlateEncode %s "%s" "%s" > "%s"'% \
+(paper_option, tmpfile, pdffile, outfile)
 if sys.platform == 'win32': command = command.replace('=', '#')
 verbose.report(command, 'debug')
 exit_status = os.system(command)
@@ -1446,16 +1453,24 @@ image.\nHere is the full report generated by pdftops: \n\n' + fh.read())
 os.remove(tmpfile)
 shutil.move(psfile, tmpfile)
 if eps:
-pstoeps(tmpfile, bbox)
+pstoeps(tmpfile, bbox, use_original_bbox=True)
 for fname in glob.glob(tmpfile+'.*'):
 os.remove(fname)
 
 
-def get_bbox(tmpfile, bbox):
+def get_bbox(tmpfile, bbox, use_original_bbox=False):
 """
 Use ghostscript's bbox device to find the center of the bounding box. Return
 an appropriately sized bbox centered around that point. A bit of a hack.
 """
+
+if use_original_bbox:
+l, b, r, t = bbox
+bbox_info = 'BoundingBox: %d %d %d %d' % (l, b, npy.ceil(r), npy.ceil(t))
+hires_bbox_info = 'HiResBoundingBox: %.6f %.6f %.6f %.6f' % (l, b, r, t)
+
+return '\n'.join([bbox_info, hires_bbox_info])
+
 outfile = tmpfile + '.output'
 if sys.platform == 'win32': gs_exe = 'gswin32c'
 else: gs_exe = 'gs'
@@ -1493,11 +1508,11 @@ Here is the Ghostscript output:\n\n%s'% bbox_info)
 return '\n'.join([bbox_info, hires_bbox_info])
 
 
-def pstoeps(tmpfile, bbox):
+def pstoeps(tmpfile, bbox, use_original_bbox=False):
 """
 Convert the postscript to encapsulated postscript.
 """
-bbox_info = get_bbox(tmpfile, bbox)
+bbox_info = get_bbox(tmpfile, bbox, use_original_bbox=use_original_bbox)
 
 epsfile = tmpfile + '.eps'
 epsh = file(epsfile, 'w')
@@ -1552,6 +1567,7 @@ def pstoeps(tmpfile, bbox):
 shutil.move(epsfile, tmpfile)
 
 
+
 class FigureManagerPS(FigureManagerBase):
 pass
 
--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev ___
Matplo

Re: [Matplotlib-users] Save eps ghostscript error

2010-01-11 Thread Jae-Joon Lee
On Mon, Jan 11, 2010 at 6:49 PM, John Reid  wrote:
> Thanks for help so far. Any more ideas? I'll try the svn if it is just a
> case of checking it out and compiling.
>

Please try.
I don't think the current  svn version will make any difference. But,
at least I can send you a patch that I think fix the problem so that
you can test it.
I'll post the patch here soon.

Regards.

-JJ

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] contour plots with logarithmic axes

2010-01-11 Thread Eric Firing
Jae-Joon Lee wrote:
> Contour will work as expected if the axes is in log scale. See below.
> 
> z = np.arange(100).reshape((10,10))
> x = np.logspace(0, 4, 10)
> y = np.logspace(0, 4, 10)
> 
> ax1 = subplot(121)
> ax1.contour(np.log10(x), np.log10(y), z)
> 
> ax2 = subplot(122)
> ax2.set_xscale("log")
> ax2.set_yscale("log")
> ax2.contour(x, y, z)

JJ,

Actually, I think your example illustrates that there is a problem with 
the second approach--the first subplot generates straight lines, the 
second does not.  The contour calculation itself really needs to be done 
in coordinates that are linear as displayed, because the contour 
locations are determined by linear interpolation.

Adding support for log scales to make contour work right in your second 
example would be easy; making it work with more general transforms, and 
making it work when the transform changes after the call to contour, 
would be harder.

I will have to look into this.

Eric


> 
> Regards,
> 
> -JJ
> 
> p.s. good to see another astronomer begin to use matplotlib.
> 
> 
> On Mon, Jan 11, 2010 at 3:33 PM, Jonathan Slavin
>  wrote:
>> Is there any way to simply make a contour plot with logarithmic axes
>> using matplotlib?  I found a workaround by plotting log10(x), log10(y),
>> but it'd be nicer if it was more direct.
>>
>> As someone new to matplotlib (experienced in IDL) I'm finding much to
>> like, but some things are more difficult for no clear reason.  It would
>> seem to me that whether the axes are logarithmic or not would be a nice
>> thing to have as an attribute of the plot object.  I'm not familiar yet
>> with the matplotlib internals to know how difficult that would be to
>> implement, but it sure would be convenient.
>>
>> Jon Slavin
>>
>>
>> --
>> This SF.Net email is sponsored by the Verizon Developer Community
>> Take advantage of Verizon's best-in-class app development support
>> A streamlined, 14 day to market process makes app distribution fast and easy
>> Join now and get one step closer to millions of Verizon customers
>> http://p.sf.net/sfu/verizon-dev2dev
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
> 
> --
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Save eps ghostscript error

2010-01-11 Thread John Reid
Jae-Joon Lee wrote:
> My guess is that somehow the output format of bbox device in the
> recent ghostscript has changed.
> 
> What kind of output do you get when you run
> 
>> gs -dBATCH -dNOPAUSE -sDEVICE=bbox test.eps
> 
> in your shell (replace "test.eps" with any eps file you have)
> 
> I get
> 
> GPL Ghostscript 8.61 (2007-11-21)
> Copyright (C) 2007 Artifex Software, Inc.  All rights reserved.
> This software comes with NO WARRANTY: see the file PUBLIC for details.
> %%BoundingBox: 71 214 541 578
> %%HiResBoundingBox: 71.207998 214.811993 540.629984 577.169982
> 
> The last two lines are what matplotlib requires to work.

I get
GPL Ghostscript 8.70 (2009-07-31)
Copyright (C) 2009 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
%%BoundingBox: 69 210 541 574
%%HiResBoundingBox: 69.155998 210.131994 540.203960 573.335983

which looks pretty similar to me

> 
> Meanwhile, can you test if following changes make things work?
> 
> In lib/matplotlib/backends/backend_ps.py, comment out following two
> lines near the end of the function "xpdf_distill" (around line 1458 in
> my code), i.e.,
> 
> if eps:
> pstoeps(tmpfile, bbox)
> 
> It will not raise the error, but may give you a wrong bbox.
> 
They were at line 1363. Now it works but with the wrong bbox as you 
predicted.

Thanks for help so far. Any more ideas? I'll try the svn if it is just a 
case of checking it out and compiling.

John.


--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] contour plots with logarithmic axes

2010-01-11 Thread Jae-Joon Lee
Contour will work as expected if the axes is in log scale. See below.

z = np.arange(100).reshape((10,10))
x = np.logspace(0, 4, 10)
y = np.logspace(0, 4, 10)

ax1 = subplot(121)
ax1.contour(np.log10(x), np.log10(y), z)

ax2 = subplot(122)
ax2.set_xscale("log")
ax2.set_yscale("log")
ax2.contour(x, y, z)

Regards,

-JJ

p.s. good to see another astronomer begin to use matplotlib.


On Mon, Jan 11, 2010 at 3:33 PM, Jonathan Slavin
 wrote:
> Is there any way to simply make a contour plot with logarithmic axes
> using matplotlib?  I found a workaround by plotting log10(x), log10(y),
> but it'd be nicer if it was more direct.
>
> As someone new to matplotlib (experienced in IDL) I'm finding much to
> like, but some things are more difficult for no clear reason.  It would
> seem to me that whether the axes are logarithmic or not would be a nice
> thing to have as an attribute of the plot object.  I'm not familiar yet
> with the matplotlib internals to know how difficult that would be to
> implement, but it sure would be convenient.
>
> Jon Slavin
>
>
> --
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Save eps ghostscript error

2010-01-11 Thread Jae-Joon Lee
My guess is that somehow the output format of bbox device in the
recent ghostscript has changed.

What kind of output do you get when you run

> gs -dBATCH -dNOPAUSE -sDEVICE=bbox test.eps

in your shell (replace "test.eps" with any eps file you have)

I get

GPL Ghostscript 8.61 (2007-11-21)
Copyright (C) 2007 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
%%BoundingBox: 71 214 541 578
%%HiResBoundingBox: 71.207998 214.811993 540.629984 577.169982

The last two lines are what matplotlib requires to work.

Meanwhile, can you test if following changes make things work?

In lib/matplotlib/backends/backend_ps.py, comment out following two
lines near the end of the function "xpdf_distill" (around line 1458 in
my code), i.e.,

if eps:
pstoeps(tmpfile, bbox)

It will not raise the error, but may give you a wrong bbox.

Regards,

-JJ



On Mon, Jan 11, 2010 at 3:11 PM, John Reid  wrote:
> Thanks for looking at this. I upgraded to 99.1.1 (although the tar file
> was named 99.1.2) and I got the same error message. When I played with
> the ps.usedistiller option I found it only doesn't work when I set
> ps.usedistiller to xpdf. With False or ghostscript it works ok but gives
> me output with different page sizes. AFAIK xpdf is the way to go for
> publication quality graphics. Do you know how I can get it to work? Is
> it worth trying the svn version?
>
> Thanks,
> John.
>
>
>
> Jae-Joon Lee wrote:
>> You code works okay with the current svn.
>>
>> See if changing the distiller option makes any difference
>> ("ps.usedistiller" in the rc file).
>>
>> The best would be for you to upgrade to the recent release of
>> matplotlib if possible.
>>
>> Regards,
>>
>> -JJ
>>
>>
>> On Mon, Jan 11, 2010 at 8:35 AM, John Reid  
>> wrote:
>>> Hi,
>>>
>>> I'm using matplotlib 0.98.5.2 on Ubuntu with Ghostscript 8.70. The
>>> following code produces the following error. Can anyone verify whether
>>> this a problem with my installation or with matplotlib?
>>>
>>> import pylab as P
>>> P.figure()
>>> width=.4
>>> x1 = [-0.4,  0.6,  1.6,  2.6,  3.6,  4.6,  5.6]
>>> y1 = [1.0, 0.96875, 0.77584381616639686, 0.54678532728659146,
>>> 0.4043846450263317, 0.28361561411668612, 1.0]
>>> x2 = [0, 1, 2, 3, 4, 5, 6]
>>> y2 = [1.0, 0.97032301818547173, 0.77110383361936519,
>>> 0.54221305796207875, 0.40019201884735922, 0.28326596333427007, 1.0]
>>> P.bar(x1, y1, color='blue' , width=width, label='nodes')
>>> P.bar(x2, y2, color='green', width=width, label='occurrences')
>>> P.savefig('fraction-evaluated.eps')
>>> P.close()
>>>
>>>
>>>
>>>
>>> /home/john/Dev/MyProjects/Bio/MotifSearch/python/stem.py in ()
>>>     246 P.bar(x1, y1, color='blue' , width=width, label='nodes')
>>>     247 P.bar(x2, y2, color='green', width=width, label='occurrences')
>>> --> 248 P.savefig('fraction-evaluated.eps')
>>>     249 P.close()
>>>     250 raise
>>>
>>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/pyplot.pyc
>>> in savefig(*args, **kwargs)
>>>     343 def savefig(*args, **kwargs):
>>>     344     fig = gcf()
>>> --> 345     return fig.savefig(*args, **kwargs)
>>>     346 if Figure.savefig.__doc__ is not None:
>>>     347     savefig.__doc__ = dedent(Figure.savefig.__doc__)
>>>
>>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/figure.pyc
>>> in savefig(self, *args, **kwargs)
>>>     988                 patch.set_alpha(0.0)
>>>     989
>>> --> 990         self.canvas.print_figure(*args, **kwargs)
>>>     991
>>>     992         if transparent:
>>>
>>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_wxagg.pyc
>>> in print_figure(self, filename, *args, **kwargs)
>>>      99     def print_figure(self, filename, *args, **kwargs):
>>>     100         # Use pure Agg renderer to draw
>>> --> 101         FigureCanvasAgg.print_figure(self, filename, *args,
>>> **kwargs)
>>>     102         # Restore the current view; this is needed because the
>>>     103         # artist contains methods rely on particular attributes
>>>
>>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc
>>> in print_figure(self, filename, dpi, facecolor, edgecolor, orientation,
>>> format, **kwargs)
>>>    1417                 edgecolor=edgecolor,
>>>    1418                 orientation=orientation,
>>> -> 1419                 **kwargs)
>>>    1420         finally:
>>>    1421             self.figure.dpi = origDPI
>>>
>>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc
>>> in print_eps(self, *args, **kwargs)
>>>    1306         from backends.backend_ps import FigureCanvasPS # lazy
>>> import
>>>    1307         ps = self.switch_backends(FigureCanvasPS)
>>> -> 1308         return ps.print_eps(*args, **kwargs)
>>>    1309
>>>    1310     def print_pdf(self, *args, **kwargs):
>>>

[Matplotlib-users] contour plots with logarithmic axes

2010-01-11 Thread Jonathan Slavin
Is there any way to simply make a contour plot with logarithmic axes
using matplotlib?  I found a workaround by plotting log10(x), log10(y),
but it'd be nicer if it was more direct.  

As someone new to matplotlib (experienced in IDL) I'm finding much to
like, but some things are more difficult for no clear reason.  It would
seem to me that whether the axes are logarithmic or not would be a nice
thing to have as an attribute of the plot object.  I'm not familiar yet
with the matplotlib internals to know how difficult that would be to
implement, but it sure would be convenient.

Jon Slavin


--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Simple text style question

2010-01-11 Thread Gökhan Sever
OK JJ,

After reading your explanation, I have tried my current Qt4Agg and PS
backends. As you told coloring worked only with PS backend. See my sample
test-snippets.

plt.rcParams["text.latex.preamble"] = r"\usepackage{color}"

plt.plot(range(10)); plt.ylabel("\color{red} {red}, \color{blue} {blue}");
plt.savefig("hello.png")

See the saved png and ps files at

http://ccnworks.googlecode.com/svn/trunk/hello.png
http://ccnworks.googlecode.com/svn/trunk/hello.ps

Another thing I noted in these images, Qt4Agg produced one looks much
prettier to my eyes than the PS. What could be causing the jiggly rendering
in the PS?

Any ideas?


On Mon, Jan 11, 2010 at 1:10 PM, Jae-Joon Lee  wrote:

> First of all, to use "\color" with TeX, you need to use "color"
> package, i.e., you need to modify your latex preamble to include that
> package. This can be done by
>
> import matplotlib.pyplot as plt
> plt.rcParams["text.latex.preamble"] = r"\usepackage{color}"
>
> I guess the error you encounter is because of this (I'm not sure as
> the error message is slightly different in my machine).
>
> However, this WON'T work in general!
> The color information in the dvi (or png) file is ignored in most
> cases (the only exception I know is the ps backend which does not read
> in dvi of png output).
> So, if you only want ps output, you can use usetex with "\color" command.
>
> In matplotlib, a single Text object only have a single color
> associated. So changing the color of the text within the string is be
> hardly possible (except in the ps backend). So, I guess your best
> option is to call "text" (or "annotate") multiple times with different
> colors with fine-tuned text positions.
>
> FYI, It is possible to have two (or more) text instances of different
> colors packed together (somewhat similar to this example
>
> http://matplotlib.sourceforge.net/plot_directive/users/plotting/examples/anchored_box04.hires.png
> ),
>
> Regards,
>
> -JJ
>
> On Mon, Jan 11, 2010 at 11:13 AM, Gökhan Sever 
> wrote:
> > This seems like the solution. However when I try:
> >
> > I[1]: plt.plot(range(10))
> > I[2]: plt.ylabel(r"{\color{red} a red text}")
> >
> > It doesn't function and produce an ugly set of error messages:
> >
> > I[3]: ERROR: An unexpected error occurred while tokenizing input
> > The following traceback may be corrupted or invalid
> > The error message is: ('EOF in multi-line statement', (573, 0))
> >
> > ERROR: An unexpected error occurred while tokenizing input
> > The following traceback may be corrupted or invalid
> > The error message is: ('EOF in multi-line statement', (573, 0))
> >
> > ERROR: An unexpected error occurred while tokenizing input
> > The following traceback may be corrupted or invalid
> > The error message is: ('EOF in multi-line statement', (573, 0))
> >
> > ERROR: An unexpected error occurred while tokenizing input
> > The following traceback may be corrupted or invalid
> > The error message is: ('EOF in multi-line statement', (573, 0))
> >
> > ERROR: An unexpected error occurred while tokenizing input
> > The following traceback may be corrupted or invalid
> > The error message is: ('EOF in multi-line statement', (566, 0))
> >
> >
> ---
> > RuntimeError  Traceback (most recent call
> last)
> >
> >
> /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_qt4.pyc
> > in resizeEvent(self, event)
> > 167 hinch = h/dpival
> > 168 self.figure.set_size_inches( winch, hinch )
> > --> 169 self.draw()
> > 170 self.update()
> > 171 QtGui.QWidget.resizeEvent(self, event)
> >
> >
> /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_qt4agg.pyc
> > in draw(self)
> > 128 if DEBUG: print "FigureCanvasQtAgg.draw", self
> > 129 self.replot = True
> > --> 130 FigureCanvasAgg.draw(self)
> > 131 self.update()
> > 132
> >
> >
> /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_agg.pyc
> > in draw(self)
> > 386
> > 387 self.renderer = self.get_renderer()
> > --> 388 self.figure.draw(self.renderer)
> > 389
> > 390 def get_renderer(self):
> >
> > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in
> > draw_wrapper(artist, renderer, *kl)
> >  53 def draw_wrapper(artist, renderer, *kl):
> >  54 before(artist, renderer)
> > ---> 55 draw(artist, renderer, *kl)
> >  56 after(artist, renderer)
> >  57
> >
> > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/figure.pyc in
> > draw(self, renderer)
> > 800 dsu.sort(key=itemgetter(0))
> > 801 for zorder, func, args in dsu:
> > --> 802 func(*args)
> > 803
> > 804 renderer.close_group('figure')
> >
> > /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib

Re: [Matplotlib-users] another problem with hardcoded colors

2010-01-11 Thread Jae-Joon Lee
On Mon, Jan 11, 2010 at 2:38 PM, Dominik Szczerba  wrote:
> Hmmm, that property really deserves its own rc param, but if you do not
> like it, it should at least be somewhere automatically set to the
> current background color to be resistant against people like me ;) I
> would be happy to have such a fix...
>

I just committed a change that makes the face- and edgecolor of the
legend patch to match those of the axes patch.

The reason I'm not very kin to introduce such new rc parameters is
partly that, we actually needs a lot of rc parameters, not just the
facecolor of the legend parch. What about the edgecolor of the legend
patch, or the linewidth? Or the color of the legend text. What about
the colors of the parch around the annotation text?

I don't think it is desirable to add a new rc parameter for every
property that needs to be customized.
In my personal opinion, one of the the best way to customize the plot
is to have something like CSS that supports inheritance of properties.

So, I'm inclined to leave it as is. But other developers may have
different thoughts.

Regards,

-JJ

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Save eps ghostscript error

2010-01-11 Thread John Reid
Thanks for looking at this. I upgraded to 99.1.1 (although the tar file 
was named 99.1.2) and I got the same error message. When I played with 
the ps.usedistiller option I found it only doesn't work when I set 
ps.usedistiller to xpdf. With False or ghostscript it works ok but gives 
me output with different page sizes. AFAIK xpdf is the way to go for 
publication quality graphics. Do you know how I can get it to work? Is 
it worth trying the svn version?

Thanks,
John.



Jae-Joon Lee wrote:
> You code works okay with the current svn.
> 
> See if changing the distiller option makes any difference
> ("ps.usedistiller" in the rc file).
> 
> The best would be for you to upgrade to the recent release of
> matplotlib if possible.
> 
> Regards,
> 
> -JJ
> 
> 
> On Mon, Jan 11, 2010 at 8:35 AM, John Reid  
> wrote:
>> Hi,
>>
>> I'm using matplotlib 0.98.5.2 on Ubuntu with Ghostscript 8.70. The
>> following code produces the following error. Can anyone verify whether
>> this a problem with my installation or with matplotlib?
>>
>> import pylab as P
>> P.figure()
>> width=.4
>> x1 = [-0.4,  0.6,  1.6,  2.6,  3.6,  4.6,  5.6]
>> y1 = [1.0, 0.96875, 0.77584381616639686, 0.54678532728659146,
>> 0.4043846450263317, 0.28361561411668612, 1.0]
>> x2 = [0, 1, 2, 3, 4, 5, 6]
>> y2 = [1.0, 0.97032301818547173, 0.77110383361936519,
>> 0.54221305796207875, 0.40019201884735922, 0.28326596333427007, 1.0]
>> P.bar(x1, y1, color='blue' , width=width, label='nodes')
>> P.bar(x2, y2, color='green', width=width, label='occurrences')
>> P.savefig('fraction-evaluated.eps')
>> P.close()
>>
>>
>>
>>
>> /home/john/Dev/MyProjects/Bio/MotifSearch/python/stem.py in ()
>> 246 P.bar(x1, y1, color='blue' , width=width, label='nodes')
>> 247 P.bar(x2, y2, color='green', width=width, label='occurrences')
>> --> 248 P.savefig('fraction-evaluated.eps')
>> 249 P.close()
>> 250 raise
>>
>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/pyplot.pyc
>> in savefig(*args, **kwargs)
>> 343 def savefig(*args, **kwargs):
>> 344 fig = gcf()
>> --> 345 return fig.savefig(*args, **kwargs)
>> 346 if Figure.savefig.__doc__ is not None:
>> 347 savefig.__doc__ = dedent(Figure.savefig.__doc__)
>>
>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/figure.pyc
>> in savefig(self, *args, **kwargs)
>> 988 patch.set_alpha(0.0)
>> 989
>> --> 990 self.canvas.print_figure(*args, **kwargs)
>> 991
>> 992 if transparent:
>>
>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_wxagg.pyc
>> in print_figure(self, filename, *args, **kwargs)
>>  99 def print_figure(self, filename, *args, **kwargs):
>> 100 # Use pure Agg renderer to draw
>> --> 101 FigureCanvasAgg.print_figure(self, filename, *args,
>> **kwargs)
>> 102 # Restore the current view; this is needed because the
>> 103 # artist contains methods rely on particular attributes
>>
>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc
>> in print_figure(self, filename, dpi, facecolor, edgecolor, orientation,
>> format, **kwargs)
>>1417 edgecolor=edgecolor,
>>1418 orientation=orientation,
>> -> 1419 **kwargs)
>>1420 finally:
>>1421 self.figure.dpi = origDPI
>>
>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc
>> in print_eps(self, *args, **kwargs)
>>1306 from backends.backend_ps import FigureCanvasPS # lazy
>> import
>>1307 ps = self.switch_backends(FigureCanvasPS)
>> -> 1308 return ps.print_eps(*args, **kwargs)
>>1309
>>1310 def print_pdf(self, *args, **kwargs):
>>
>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
>> in print_eps(self, outfile, *args, **kwargs)
>> 867
>> 868 def print_eps(self, outfile, *args, **kwargs):
>> --> 869 return self._print_ps(outfile, 'eps', *args, **kwargs)
>> 870
>> 871 def _print_ps(self, outfile, format, *args, **kwargs):
>>
>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
>> in _print_ps(self, outfile, format, *args, **kwargs)
>> 893 else:
>> 894 self._print_figure(outfile, format, imagedpi,
>> facecolor, edgecolor,
>> --> 895orientation, isLandscape, papertype)
>> 896
>> 897 def _print_figure(self, outfile, format, dpi=72,
>> facecolor='w', edgecolor='w',
>>
>> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
>> in _print_figure(self, outfile, format, dpi, facecolor, edgecolor,
>> orientation, i

Re: [Matplotlib-users] another problem with hardcoded colors

2010-01-11 Thread Dominik Szczerba
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jae-Joon Lee wrote:
> On Sat, Jan 9, 2010 at 4:27 PM, Dominik Szczerba  wrote:
>> When using white over back color scheme the legend() is unreadable, with
>> apparently hard-coded white legend background - or is there a way to set
>> it in the rc file?
>>
> 
> Unfortunately no.
> I recommend you to manually change the color of the legend frame.
> 
> l = plt.legend()
> l.legendPatch.set_fc(plt.rcParams["axes.facecolor"])
> 
> I'm not very kin to introduce a new rc param for this. I think it is
> good enough to have the legend background to follow the color of the
> axes, as above. I'll try to commit the relevant change soon.
> But any other suggestion will be welcomed.

Hmmm, that property really deserves its own rc param, but if you do not
like it, it should at least be somewhere automatically set to the
current background color to be resistant against people like me ;) I
would be happy to have such a fix...

Thanks,
Dominik

> 
> Regards,
> 
> -JJ
> 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAktLfhwACgkQ/EBMh9bUuzKcTACglg3AmZ8PYFztHoQKeMTe+Elj
KrcAnRi8FCAOpY9Pe96+0MQPyTZ7cnQ4
=MknU
-END PGP SIGNATURE-

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] another problem with hardcoded colors

2010-01-11 Thread Jae-Joon Lee
On Sat, Jan 9, 2010 at 4:27 PM, Dominik Szczerba  wrote:
> When using white over back color scheme the legend() is unreadable, with
> apparently hard-coded white legend background - or is there a way to set
> it in the rc file?
>

Unfortunately no.
I recommend you to manually change the color of the legend frame.

l = plt.legend()
l.legendPatch.set_fc(plt.rcParams["axes.facecolor"])

I'm not very kin to introduce a new rc param for this. I think it is
good enough to have the legend background to follow the color of the
axes, as above. I'll try to commit the relevant change soon.
But any other suggestion will be welcomed.

Regards,

-JJ

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Simple text style question

2010-01-11 Thread Jae-Joon Lee
First of all, to use "\color" with TeX, you need to use "color"
package, i.e., you need to modify your latex preamble to include that
package. This can be done by

import matplotlib.pyplot as plt
plt.rcParams["text.latex.preamble"] = r"\usepackage{color}"

I guess the error you encounter is because of this (I'm not sure as
the error message is slightly different in my machine).

However, this WON'T work in general!
The color information in the dvi (or png) file is ignored in most
cases (the only exception I know is the ps backend which does not read
in dvi of png output).
So, if you only want ps output, you can use usetex with "\color" command.

In matplotlib, a single Text object only have a single color
associated. So changing the color of the text within the string is be
hardly possible (except in the ps backend). So, I guess your best
option is to call "text" (or "annotate") multiple times with different
colors with fine-tuned text positions.

FYI, It is possible to have two (or more) text instances of different
colors packed together (somewhat similar to this example
http://matplotlib.sourceforge.net/plot_directive/users/plotting/examples/anchored_box04.hires.png),

Regards,

-JJ

On Mon, Jan 11, 2010 at 11:13 AM, Gökhan Sever  wrote:
> This seems like the solution. However when I try:
>
> I[1]: plt.plot(range(10))
> I[2]: plt.ylabel(r"{\color{red} a red text}")
>
> It doesn't function and produce an ugly set of error messages:
>
> I[3]: ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (573, 0))
>
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (573, 0))
>
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (573, 0))
>
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (573, 0))
>
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (566, 0))
>
> ---
> RuntimeError  Traceback (most recent call last)
>
> /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_qt4.pyc
> in resizeEvent(self, event)
>     167 hinch = h/dpival
>     168 self.figure.set_size_inches( winch, hinch )
> --> 169 self.draw()
>     170 self.update()
>     171 QtGui.QWidget.resizeEvent(self, event)
>
> /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_qt4agg.pyc
> in draw(self)
>     128 if DEBUG: print "FigureCanvasQtAgg.draw", self
>     129 self.replot = True
> --> 130 FigureCanvasAgg.draw(self)
>     131 self.update()
>     132
>
> /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_agg.pyc
> in draw(self)
>     386
>     387 self.renderer = self.get_renderer()
> --> 388 self.figure.draw(self.renderer)
>     389
>     390 def get_renderer(self):
>
> /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in
> draw_wrapper(artist, renderer, *kl)
>  53 def draw_wrapper(artist, renderer, *kl):
>  54 before(artist, renderer)
> ---> 55 draw(artist, renderer, *kl)
>  56 after(artist, renderer)
>  57
>
> /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/figure.pyc in
> draw(self, renderer)
>     800 dsu.sort(key=itemgetter(0))
>     801 for zorder, func, args in dsu:
> --> 802 func(*args)
>     803
>     804 renderer.close_group('figure')
>
> /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in
> draw_wrapper(artist, renderer, *kl)
>  53 def draw_wrapper(artist, renderer, *kl):
>  54 before(artist, renderer)
> ---> 55 draw(artist, renderer, *kl)
>  56 after(artist, renderer)
>  57
>
> /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/axes.pyc in
> draw(self, renderer, inframe)
>    1755
>    1756 for zorder, a in dsu:
> -> 1757 a.draw(renderer)
>    1758
>    1759 renderer.close_group('axes')
>
> /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in
> draw_wrapper(artist, renderer, *kl)
>  53 def draw_wrapper(artist, renderer, *kl):
>  54 before(artist, renderer)
> ---> 55 draw(artist, renderer, *kl)
>  56 after(artist, renderer)
>  57
>
> /home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/axis.pyc in
> draw(self, rende

Re: [Matplotlib-users] Setting Relative Heights For Figure Rows

2010-01-11 Thread Jae-Joon Lee
See this example

http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_hist.html

Or, you're willing to learn something new, you may use axes_grid toolkit.

http://matplotlib.sourceforge.net/examples/axes_grid/scatter_hist.html


-JJ

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Save eps ghostscript error

2010-01-11 Thread Jae-Joon Lee
You code works okay with the current svn.

See if changing the distiller option makes any difference
("ps.usedistiller" in the rc file).

The best would be for you to upgrade to the recent release of
matplotlib if possible.

Regards,

-JJ


On Mon, Jan 11, 2010 at 8:35 AM, John Reid  wrote:
> Hi,
>
> I'm using matplotlib 0.98.5.2 on Ubuntu with Ghostscript 8.70. The
> following code produces the following error. Can anyone verify whether
> this a problem with my installation or with matplotlib?
>
> import pylab as P
> P.figure()
> width=.4
> x1 = [-0.4,  0.6,  1.6,  2.6,  3.6,  4.6,  5.6]
> y1 = [1.0, 0.96875, 0.77584381616639686, 0.54678532728659146,
> 0.4043846450263317, 0.28361561411668612, 1.0]
> x2 = [0, 1, 2, 3, 4, 5, 6]
> y2 = [1.0, 0.97032301818547173, 0.77110383361936519,
> 0.54221305796207875, 0.40019201884735922, 0.28326596333427007, 1.0]
> P.bar(x1, y1, color='blue' , width=width, label='nodes')
> P.bar(x2, y2, color='green', width=width, label='occurrences')
> P.savefig('fraction-evaluated.eps')
> P.close()
>
>
>
>
> /home/john/Dev/MyProjects/Bio/MotifSearch/python/stem.py in ()
>     246 P.bar(x1, y1, color='blue' , width=width, label='nodes')
>     247 P.bar(x2, y2, color='green', width=width, label='occurrences')
> --> 248 P.savefig('fraction-evaluated.eps')
>     249 P.close()
>     250 raise
>
> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/pyplot.pyc
> in savefig(*args, **kwargs)
>     343 def savefig(*args, **kwargs):
>     344     fig = gcf()
> --> 345     return fig.savefig(*args, **kwargs)
>     346 if Figure.savefig.__doc__ is not None:
>     347     savefig.__doc__ = dedent(Figure.savefig.__doc__)
>
> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/figure.pyc
> in savefig(self, *args, **kwargs)
>     988                 patch.set_alpha(0.0)
>     989
> --> 990         self.canvas.print_figure(*args, **kwargs)
>     991
>     992         if transparent:
>
> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_wxagg.pyc
> in print_figure(self, filename, *args, **kwargs)
>      99     def print_figure(self, filename, *args, **kwargs):
>     100         # Use pure Agg renderer to draw
> --> 101         FigureCanvasAgg.print_figure(self, filename, *args,
> **kwargs)
>     102         # Restore the current view; this is needed because the
>     103         # artist contains methods rely on particular attributes
>
> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc
> in print_figure(self, filename, dpi, facecolor, edgecolor, orientation,
> format, **kwargs)
>    1417                 edgecolor=edgecolor,
>    1418                 orientation=orientation,
> -> 1419                 **kwargs)
>    1420         finally:
>    1421             self.figure.dpi = origDPI
>
> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc
> in print_eps(self, *args, **kwargs)
>    1306         from backends.backend_ps import FigureCanvasPS # lazy
> import
>    1307         ps = self.switch_backends(FigureCanvasPS)
> -> 1308         return ps.print_eps(*args, **kwargs)
>    1309
>    1310     def print_pdf(self, *args, **kwargs):
>
> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
> in print_eps(self, outfile, *args, **kwargs)
>     867
>     868     def print_eps(self, outfile, *args, **kwargs):
> --> 869         return self._print_ps(outfile, 'eps', *args, **kwargs)
>     870
>     871     def _print_ps(self, outfile, format, *args, **kwargs):
>
> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
> in _print_ps(self, outfile, format, *args, **kwargs)
>     893         else:
>     894             self._print_figure(outfile, format, imagedpi,
> facecolor, edgecolor,
> --> 895                                orientation, isLandscape, papertype)
>     896
>     897     def _print_figure(self, outfile, format, dpi=72,
> facecolor='w', edgecolor='w',
>
> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
> in _print_figure(self, outfile, format, dpi, facecolor, edgecolor,
> orientation, isLandscape, papertype)
>    1036             gs_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox)
>    1037         elif rcParams['ps.usedistiller'] == 'xpdf':
> -> 1038             xpdf_distill(tmpfile, isEPSF, ptype=papertype,
> bbox=bbox)
>    1039
>    1040         if passed_in_file_object:
>
> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
> in xpdf_distill(tmpfile, eps, ptype, bbox)
>    1311     shutil.move(psfile, tmpfile)
>    1312     if eps:
> -> 1313         pstoeps(tmpfile, bbox)
>    1314     for fname in glob.glob(tmpfile+'.*'):
>    131

Re: [Matplotlib-users] Simple text style question

2010-01-11 Thread Gökhan Sever
This seems like the solution. However when I try:

I[1]: plt.plot(range(10))
I[2]: plt.ylabel(r"{\color{red} a red text}")

It doesn't function and produce an ugly set of error messages:

I[3]: ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (573, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (573, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (573, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (573, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (566, 0))

---
RuntimeError  Traceback (most recent call last)

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_qt4.pyc
in resizeEvent(self, event)
167 hinch = h/dpival
168 self.figure.set_size_inches( winch, hinch )
--> 169 self.draw()
170 self.update()
171 QtGui.QWidget.resizeEvent(self, event)

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_qt4agg.pyc
in draw(self)
128 if DEBUG: print "FigureCanvasQtAgg.draw", self
129 self.replot = True
--> 130 FigureCanvasAgg.draw(self)
131 self.update()
132

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_agg.pyc
in draw(self)
386
387 self.renderer = self.get_renderer()
--> 388 self.figure.draw(self.renderer)
389
390 def get_renderer(self):

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in
draw_wrapper(artist, renderer, *kl)
 53 def draw_wrapper(artist, renderer, *kl):
 54 before(artist, renderer)
---> 55 draw(artist, renderer, *kl)
 56 after(artist, renderer)
 57

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/figure.pyc in
draw(self, renderer)
800 dsu.sort(key=itemgetter(0))
801 for zorder, func, args in dsu:
--> 802 func(*args)
803
804 renderer.close_group('figure')

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in
draw_wrapper(artist, renderer, *kl)
 53 def draw_wrapper(artist, renderer, *kl):
 54 before(artist, renderer)
---> 55 draw(artist, renderer, *kl)
 56 after(artist, renderer)
 57

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/axes.pyc in
draw(self, renderer, inframe)
   1755
   1756 for zorder, a in dsu:
-> 1757 a.draw(renderer)
   1758
   1759 renderer.close_group('axes')

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in
draw_wrapper(artist, renderer, *kl)
 53 def draw_wrapper(artist, renderer, *kl):
 54 before(artist, renderer)
---> 55 draw(artist, renderer, *kl)
 56 after(artist, renderer)
 57

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/axis.pyc in
draw(self, renderer, *args, **kwargs)
819 self._update_label_position(ticklabelBoxes, ticklabelBoxes2)
820
--> 821 self.label.draw(renderer)
822
823 self._update_offset_text_position(ticklabelBoxes,
ticklabelBoxes2)

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/artist.pyc in
draw_wrapper(artist, renderer, *kl)
 53 def draw_wrapper(artist, renderer, *kl):
 54 before(artist, renderer)
---> 55 draw(artist, renderer, *kl)
 56 after(artist, renderer)
 57

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/text.pyc in
draw(self, renderer)
547 renderer.open_group('text', self.get_gid())
548
--> 549 bbox, info = self._get_layout(renderer)
550 trans = self.get_transform()
551

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/text.pyc in
_get_layout(self, renderer)
303 w, h, d = get_text_width_height_descent(clean_line,
304
self._fontproperties,
--> 305 ismath=ismath)
306 if baseline is None:
307 baseline = h - d

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_agg.pyc
in get_text_width_height_descent(self, s, prop, ismath)
169 fontsize = prop.get_size_in_points()
170 w, h, d = texmanager.get_text_width_height_descent(s

Re: [Matplotlib-users] Simple text style question

2010-01-11 Thread Jeff Whitaker
Gökhan Sever wrote:
>
>
> On Mon, Jan 11, 2010 at 6:51 AM, Jeff Whitaker  > wrote:
>
> Gökhan Sever wrote:
>
> Hello,
>
> Is there a way to color words differently in a label or title,
> for example:
>
> ylabel("measurement 1 (in red color)" , "measurement 2 (in
> blue color)") to match with the plotted line colors?
>
> Thanks.
>
> -- 
> Gökhan
>
> Gökhan:
>
> ylabel('measurement 1',color='r')
> ylabel('measurement 2',color='b')
>
>
> -Jeff
>
>
> In this fashion the second call replaces the first text. What I want 
> is two words next to each other and in different colors.
>
> -- 
> Gökhan

Gökhan:  Then I think you'll have to go with the TeX solution (i..e 
\color{red}{Red text goes here} \color{blue}{Blue text goes here}).  -

Jeff

-- 
Jeffrey S. Whitaker Phone  : (303)497-6313
Meteorologist   FAX: (303)497-6449
NOAA/OAR/PSD  R/PSD1Email  : jeffrey.s.whita...@noaa.gov
325 BroadwayOffice : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg



--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Setting Relative Heights For Figure Rows

2010-01-11 Thread Matthias Michler
Hi Chris,

I think pyplot.axes does what you are after, e.g.
ax1 = axes([0.1, 0.3, 0.8, 0.6])
ax2 = axes([0.1, 0.1, 0.8, 0.1])

Kind regards,
Matthias

from the docs of pyplot.axes:
`axes(rect, axisbg='w')`` where *rect* = [left, bottom, width,
  height] in normalized (0, 1) units.  *axisbg* is the background
  color for the axis, default white.

On Monday 11 January 2010 15:54:10 Chris Spencer wrote:
> I wanted to display my figure legend below my figure in the second
> row, so I used subplot(211) to create two rows.
>
> However, this creates two rows of equal height, so my graph is crammed
> into half the figure height in the first row, while my tiny legend
> barely fills up any of the second row. How do you specify relative
> heights of each row? For example, I'd like to specify the first row
> takes 80% of the figure height, while the second takes 20%. I've
> searched the docs, but I can't find anything. Is this possible?
>
> Regards,
> Chris
>
> ---
>--- This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and
> easy Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Setting Relative Heights For Figure Rows

2010-01-11 Thread Chris Spencer
I wanted to display my figure legend below my figure in the second
row, so I used subplot(211) to create two rows.

However, this creates two rows of equal height, so my graph is crammed
into half the figure height in the first row, while my tiny legend
barely fills up any of the second row. How do you specify relative
heights of each row? For example, I'd like to specify the first row
takes 80% of the figure height, while the second takes 20%. I've
searched the docs, but I can't find anything. Is this possible?

Regards,
Chris

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Save eps ghostscript error

2010-01-11 Thread John Reid
Hi,

I'm using matplotlib 0.98.5.2 on Ubuntu with Ghostscript 8.70. The 
following code produces the following error. Can anyone verify whether 
this a problem with my installation or with matplotlib?

import pylab as P
P.figure()
width=.4
x1 = [-0.4,  0.6,  1.6,  2.6,  3.6,  4.6,  5.6]
y1 = [1.0, 0.96875, 0.77584381616639686, 0.54678532728659146, 
0.4043846450263317, 0.28361561411668612, 1.0]
x2 = [0, 1, 2, 3, 4, 5, 6]
y2 = [1.0, 0.97032301818547173, 0.77110383361936519, 
0.54221305796207875, 0.40019201884735922, 0.28326596333427007, 1.0]
P.bar(x1, y1, color='blue' , width=width, label='nodes')
P.bar(x2, y2, color='green', width=width, label='occurrences')
P.savefig('fraction-evaluated.eps')
P.close()




/home/john/Dev/MyProjects/Bio/MotifSearch/python/stem.py in ()
 246 P.bar(x1, y1, color='blue' , width=width, label='nodes')
 247 P.bar(x2, y2, color='green', width=width, label='occurrences')
--> 248 P.savefig('fraction-evaluated.eps')
 249 P.close()
 250 raise

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/pyplot.pyc
 
in savefig(*args, **kwargs)
 343 def savefig(*args, **kwargs):
 344 fig = gcf()
--> 345 return fig.savefig(*args, **kwargs)
 346 if Figure.savefig.__doc__ is not None:
 347 savefig.__doc__ = dedent(Figure.savefig.__doc__)

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/figure.pyc
 
in savefig(self, *args, **kwargs)
 988 patch.set_alpha(0.0)
 989
--> 990 self.canvas.print_figure(*args, **kwargs)
 991
 992 if transparent:

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_wxagg.pyc
 
in print_figure(self, filename, *args, **kwargs)
  99 def print_figure(self, filename, *args, **kwargs):
 100 # Use pure Agg renderer to draw
--> 101 FigureCanvasAgg.print_figure(self, filename, *args, 
**kwargs)
 102 # Restore the current view; this is needed because the
 103 # artist contains methods rely on particular attributes

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc
 
in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, 
format, **kwargs)
1417 edgecolor=edgecolor,
1418 orientation=orientation,
-> 1419 **kwargs)
1420 finally:
1421 self.figure.dpi = origDPI

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc
 
in print_eps(self, *args, **kwargs)
1306 from backends.backend_ps import FigureCanvasPS # lazy 
import
1307 ps = self.switch_backends(FigureCanvasPS)
-> 1308 return ps.print_eps(*args, **kwargs)
1309
1310 def print_pdf(self, *args, **kwargs):

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
 
in print_eps(self, outfile, *args, **kwargs)
 867
 868 def print_eps(self, outfile, *args, **kwargs):
--> 869 return self._print_ps(outfile, 'eps', *args, **kwargs)
 870
 871 def _print_ps(self, outfile, format, *args, **kwargs):

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
 
in _print_ps(self, outfile, format, *args, **kwargs)
 893 else:
 894 self._print_figure(outfile, format, imagedpi, 
facecolor, edgecolor,
--> 895orientation, isLandscape, papertype)
 896
 897 def _print_figure(self, outfile, format, dpi=72, 
facecolor='w', edgecolor='w',

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
 
in _print_figure(self, outfile, format, dpi, facecolor, edgecolor, 
orientation, isLandscape, papertype)
1036 gs_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox)
1037 elif rcParams['ps.usedistiller'] == 'xpdf':
-> 1038 xpdf_distill(tmpfile, isEPSF, ptype=papertype, 
bbox=bbox)
1039
1040 if passed_in_file_object:

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
 
in xpdf_distill(tmpfile, eps, ptype, bbox)
1311 shutil.move(psfile, tmpfile)
1312 if eps:
-> 1313 pstoeps(tmpfile, bbox)
1314 for fname in glob.glob(tmpfile+'.*'):
1315 os.remove(fname)

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
 
in pstoeps(tmpfile, bbox)
1362 Convert the postscript to encapsulated postscript.
1363 """
-> 1364 bbox_info = get_bbox(tmpfile, bbox)
1365
1366 epsfile = tmpfile + '.eps'

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/ma

Re: [Matplotlib-users] Simple text style question

2010-01-11 Thread Jeff Whitaker
Gökhan Sever wrote:
> Hello,
>
> Is there a way to color words differently in a label or title, for 
> example:
>
> ylabel("measurement 1 (in red color)" , "measurement 2 (in blue 
> color)") to match with the plotted line colors?
>
> Thanks.
>
> -- 
> Gökhan
Gökhan:

ylabel('measurement 1',color='r')
ylabel('measurement 2',color='b')


-Jeff


--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Simple text style question

2010-01-11 Thread Damon McDougall
Hi Gökhan,

Do you have usetex=True set? If so, have you tried the LaTeX command sequence 
\color{red}{Red text goes here} ?

Regards,
-- Damon

--
Damon McDougall
Mathematics Institute
University of Warwick
Coventry
CV4 7AL
d.mcdoug...@warwick.ac.uk

On 11 Jan 2010, at 05:48, Gökhan Sever wrote:

> Hello,
> 
> Is there a way to color words differently in a label or title, for example:
> 
> ylabel("measurement 1 (in red color)" , "measurement 2 (in blue color)") to 
> match with the plotted line colors?
> 
> Thanks.
> 
> -- 
> Gökhan
> --
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev ___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users