Re: [matplotlib-devel] problem with draw method in svn version?

2009-08-04 Thread Jonathan Demaeyer
Hello,

Thank you for your answer. When I explicitly give None as renderer argument, 
everything work well.
Now I guess the question is why the default value is not used by the method?

By the way, rasterization support wasn't introduced earlier than the 0.98.3 
version?

Regards,

Jonathan


Jae-Joon Lee a écrit :
> I guess this is related with the decorator introduced by rasterization 
> support.
> While most of the artist seems to explicitly require the renderer
> instance as the second argument of the draw method, the draw method in
> the Axes class have default value of None.
> The easiest fix seems to let the decorator returns the method with
> renderer=None as in the Axes.
> 
> By the way, Jonathan, I guess the easiest workaround for you is to
> modify your code so that it explicitly gives the renderer argument. As
> you see the default value for renderer is None. Just call it as
> draw(None).
> 
> Regards,
> 
> -JJ
> 


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Request For Comment on the mathtex Branch

2009-08-04 Thread Michael Droettboom
Freddie Witherden wrote:
> Hi,
>
> On 3 Aug 2009, at 17:39, Michael Droettboom wrote:
>   
>> Is there an additional step to install mathtex?  I thought the goal  
>> was to make "python setup.py install" work out of the box.
>> 
>
> This was the goal and I got quite close to achieving it. This latter  
> parts of this thread deal with the specific issues (relating to the  
> directory structure chosen) 
> http://sourceforge.net/mailarchive/forum.php?thread_name=A97F3AC6-1434-4E6D-AF39-9DBD4653BCB4%40witherden.org&forum_name=matplotlib-devel
>
> So I was advised by John to just assume mathtex is installed.  
> Thankfully this is not hard to do -- and is covered in the INSTALL  
> file. It is basically a case of changing to lib/mathtext and running  
> python setup.py build && python setup.py install.
>   
Sorry, I let that message slide through.  I know John may not be, but 
I'm really concerned about the build being anything more than "python 
setup.py install" -- it's going to be hard for packagers and hard for 
end users.

This problem is actually rather straightforward to solve using the 
"package_dir" mapping in distutils.  See here:

http://docs.python.org/distutils/setupscript.html#listing-whole-packages

By adding {'mathtex': 'lib/mathtex/mathtex'} to package_dir, it all 
seems to work as desired.

I've committed this change on the branch so you can see what I mean.

However, after doing that I run into another error importing mathtex 
from mathtext_demo.py:

> >>> from mathtex.mathtex_main import Mathtex
> Traceback (most recent call last):
>   File "", line 1, in 
>   File 
> "/home/mdroe/usr/lib/python2.5/site-packages/mathtex/mathtex_main.py", 
> line 2, in 
> from mathtex.parser import MathtexParser
>   File 
> "/home/mdroe/usr/lib/python2.5/site-packages/mathtex/parser.py", line 
> 7, in 
> from mathtex.boxmodel import *
>   File 
> "/home/mdroe/usr/lib/python2.5/site-packages/mathtex/boxmodel.py", 
> line 4, in 
> from mathtex.fonts import *
>   File "/home/mdroe/usr/lib/python2.5/site-packages/mathtex/fonts.py", 
> line 5, in 
> from mathtex.ft2font import FT2Font, KERNING_DEFAULT
> ImportError: No module named ft2font
It looks like it's still looking for ft2font inside of mathtex, which, 
of course, isn't there in the context of building in inside of 
matplotlib.  I thought you said that mathtex would use the ft2font from 
matplotlib if it were available -- maybe I misunderstood what you meant.

These sorts of installation issues are hard to test given that installs 
don't clean up after themselves.  Personally, I use virtualenv to create 
"clean" python environments, then install matplotlib in it, and then try 
running examples in that environment.  It's real fast to just blitz the 
environment and create a new one each time for this kind of testing.

I was able to work around this (by installing mathtex directly), but I 
ran into the following because I have "mathtext.fontset" set up 
"stixsans" in my matplotlibrc:

 > python mathtext_demo.py
Traceback (most recent call last):
  File 
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py",
 
line 352, in expose_event
self._render_figure(self._pixmap, w, h)
  File 
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtkagg.py",
 
line 75, in _render_figure
FigureCanvasAgg.draw(self)
  File 
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py",
 
line 327, in draw
self.figure.draw(self.renderer)
  File 
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/artist.py", line 
46, in draw_wrapper
draw(artist, renderer, *kl)
  File 
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 
774, in draw
for a in self.axes: a.draw(renderer)
  File 
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/artist.py", line 
46, in draw_wrapper
draw(artist, renderer, *kl)
  File "/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/axes.py", 
line 1721, in draw
a.draw(renderer)
  File 
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/artist.py", line 
46, in draw_wrapper
draw(artist, renderer, *kl)
  File "/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/axis.py", 
line 757, in draw
self.label.draw(renderer)
  File "/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/text.py", 
line 515, in draw
bbox, info = self._get_layout(renderer)
  File "/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/text.py", 
line 279, in _get_layout
clean_line, self._fontproperties, ismath=ismath)
  File 
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py",
 
line 169, in get_text_width_height_descent
self.dpi, rcParams['mathtext.default'])
  File 
"/home/mdroe/usr/lib/python2.5/site-packages/mathtex/mathtex_main.py", 
line 30, in __init__
fontset = self.fontset_mapping[fontset](default_style)
KeyError: 'stixsans'
 > 
/home/mdroe/usr/lib/python2.5/site-packag

Re: [matplotlib-devel] example data in example code

2009-08-04 Thread Josh Hemann

So, I just downloaded 0.99 rc1 and wanted to play with axesgrid examples and
got the results you reported below in your example. I am in fact naive, and
its not clear to me how to get around this problem of the demo_image module
not being found. What is the solution? 

Thanks,

Josh



John Hunter-4 wrote:
> 
> In some examples, I have been moving example functions and data into a
> module, so that they can be run from anywhere.  Many other examples
> still rely on a relative path in the examples dir.   Eg, I go to the
> gallery and download the source for the axes grid toolkit example
> simple_rgb.py, and try to run it from my desktop, I get the error "no
> module names demo_image".  While I know how to get the data, a naive
> user will not.  So in some examples I have been adopting the approach,
> eg in examples/pylab_examples/scatter_demo2.py
> 
>   import matplotlib
>   datafile = matplotlib.get_example_data('goog.npy')
> 
> These examples will run anywhere mpl is installed.  Another approach
> would to write a version of get_example_data that checks locally for a
> datafile, and if it is not where you expect to be, attempt a
> urlretrieve as a temp file.
> 
> The gallery is becoming the goto place for most users of the website,
> and I would like as many examples as possible to run after a simple
> download to the desktop .  I am sensitive to packagers who may not
> want to ship large amounts of data w/ the main library, so we may want
> to minimize the amount we ship in mpl-data which
> matplotlib.get_example_data uses, but it may be a good idea to setup a
> new svn directory at the top level (mpl_data) and write a urllib
> enabled matplotlib.get_example_data that fetches it from the repo if
> it can't find it locally.
> 
> JDH
> 


-
Josh Hemann
Statistical Advisor 
http://www.vni.com/ Visual Numerics 
jhem...@vni.com | P 720.407.4214 | F 720.407.4199 

-- 
View this message in context: 
http://www.nabble.com/example-data-in-example-code-tp24760754p24811726.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Request For Comment on the mathtex Branch

2009-08-04 Thread Freddie Witherden
Hi,

On 4 Aug 2009, at 14:12, Michael Droettboom wrote:
> However, after doing that I run into another error importing mathtex  
> from mathtext_demo.py:
>
>> >>> from mathtex.mathtex_main import Mathtex
>> Traceback (most recent call last):
>>  File "", line 1, in 
>>  File "/home/mdroe/usr/lib/python2.5/site-packages/mathtex/ 
>> mathtex_main.py", line 2, in 
>>from mathtex.parser import MathtexParser
>>  File "/home/mdroe/usr/lib/python2.5/site-packages/mathtex/ 
>> parser.py", line 7, in 
>>from mathtex.boxmodel import *
>>  File "/home/mdroe/usr/lib/python2.5/site-packages/mathtex/ 
>> boxmodel.py", line 4, in 
>>from mathtex.fonts import *
>>  File "/home/mdroe/usr/lib/python2.5/site-packages/mathtex/ 
>> fonts.py", line 5, in 
>>from mathtex.ft2font import FT2Font, KERNING_DEFAULT
>> ImportError: No module named ft2font
> It looks like it's still looking for ft2font inside of mathtex,  
> which, of course, isn't there in the context of building in inside  
> of matplotlib.  I thought you said that mathtex would use the  
> ft2font from matplotlib if it were available -- maybe I  
> misunderstood what you meant.

fonts.py seemed to slip the net, somehow, and will not try to fallback  
on matplotlib. Easy to fix.

> These sorts of installation issues are hard to test given that  
> installs don't clean up after themselves.  Personally, I use  
> virtualenv to create "clean" python environments, then install  
> matplotlib in it, and then try running examples in that  
> environment.  It's real fast to just blitz the environment and  
> create a new one each time for this kind of testing.

Yes, I've been bitten by that several times now. I'll look into  
virtualenv, might save me some headaches.

> I was able to work around this (by installing mathtex directly), but  
> I ran into the following because I have "mathtext.fontset" set up  
> "stixsans" in my matplotlibrc:

I, for some reason, never ported stixsans over. Again easy to do and  
shouldn't take long. The stix and bakoma fonts currently work and  
unicode support is in mathtex, just needs some support code in  
matplotlib.

> But I don't know if it matters to do this until the matplotlib/ 
> mathtex branch is merged back into the trunk.

It is probably wroth doing it as soon as mathtex has a couple of  
stable releases behind it.

>> There is a slight performance penalty associated with using mathtex  
>> --  due to each expression being parsed twice -- where matplotlib  
>> caches  parsed expressions. If this is a problem let me know and  
>> I'll work on  something.
>>
> It would be great to preserve the caching behavior, even if that  
> lives in the matplotlib side and not in the mathtex project itself.   
> Where it matters is with interactive panning and zooming: if the  
> tick labels use math, as in a log plot for example, they can get re- 
> renderered many times.  I recall benchmarking it at the time I did  
> the big math re-write, and it was definitely worth worrying about at  
> the time, though I can't find my notes.  If you benchmark and come  
> to a different conclusion (because things have become faster in  
> other ways) just let us know.

It is probably easiest if I add it to the Mathtex class itself.  
Parsing is currently the biggest bottle-neck even with packrat parsing  
enabled. I did try zooming around the mathtext demo plot and found  
there to be quite a lot of lag, so it does seem worth it.

Overall I think the best plan of action is to add caching support and  
stixsans into mathtex, fix the error with imports and then release  
version 0.2 of mathtex. Then matplotlib can be updated (and set to  
pull 0.2 from subversion).

Regards, Freddie.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] example data in example code

2009-08-04 Thread John Hunter
On Tue, Aug 4, 2009 at 11:17 AM, Josh Hemann wrote:
>
> So, I just downloaded 0.99 rc1 and wanted to play with axesgrid examples and
> got the results you reported below in your example. I am in fact naive, and
> its not clear to me how to get around this problem of the demo_image module
> not being found. What is the solution?

The solution is to get the examples directory and run it from there,
where it will have the example data.  Although I added support for
having auto-fetched data in svn, we haven't ported  the examples over
to use it yet.  If you have svn you can grab the examples dir with

 svn co 
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib/examples
mpl_examples

and then run the examples in their directory, eg examples/axes_grid.
Then they should be able to see their data.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] mpl_data_demo example

2009-08-04 Thread Gökhan Sever
Get this tiny error:

[gse...@ccn misc]$ python mpl_data_demo.py
  File "mpl_data_demo.py", line 1
"""
^
IndentationError: unexpected indent

Not sure it is a Python version specific issue or not:
Python 2.6 (r26:66714, Jun  8 2009)


Index: mpl_data_demo.py
===
--- mpl_data_demo.py(revision 7353)
+++ mpl_data_demo.py(working copy)
@@ -1,7 +1,7 @@
-"""
-Grab mpl data from the ~/.matplotlib/mpl_data cache if it exists, else
-fetch it from svn and cache it
-"""
+"""
+Grab mpl data from the ~/.matplotlib/mpl_data cache if it exists, else
+fetch it from svn and cache it
+"""
 import matplotlib.cbook as cbook
 import matplotlib.pyplot as plt
 fname = cbook.get_mpl_data('lena.png', asfileobj=False)



-- 
Gökhan


mypatch.diff
Description: Binary data
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] example data in example code

2009-08-04 Thread Jouni K . Seppänen
John Hunter  writes:

> # TODO: how to handle stale data in the cache that has been
> # updated from svn -- is there a clean http way to get the current
> # revision number that will not leave us at the mercy of html
> # changes at sf?

The mod_dav_svn server sends an ETag header that happens to contain the
revision number where the file was last modified, and a Last-Modified
header that contains the date of that revision. The clean http way to
make use of these is to make a conditional request - I hacked up a
processor class for urllib2 that does this, and checked it in.

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


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mpl_data_demo example

2009-08-04 Thread Jouni K . Seppänen
Gökhan Sever  writes:

> Get this tiny error:

I committed your patch; thanks!

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


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mkpg on OSX

2009-08-04 Thread John Hunter
On Mon, Aug 3, 2009 at 2:58 PM, Russell E. Owen wrote:

> If you are using bdist_mpkg then it should do the right thing as long as
> you build the python with your python.org python
> (/Library/Frameworks...) instead of the system python.

Following some of the suggestions in this thread and on the sf bug report

  
https://sourceforge.net/tracker/index.php?func=detail&aid=2831805&group_id=80706&atid=560720

I rebuilt the OSX binaries from scratch, using a src framework build
of python, and activetcl as suggested by Russell.  The rc2 build
candidates are at

  http://drop.io/xortel1#

If anyone has a chance to test them, that would be great.

JDH

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mkpg on OSX

2009-08-04 Thread Russell Owen

On Aug 4, 2009, at 8:09 PM, John Hunter wrote:

> On Mon, Aug 3, 2009 at 2:58 PM, Russell E. Owen wrote:
>
>> If you are using bdist_mpkg then it should do the right thing as  
>> long as
>> you build the python with your python.org python
>> (/Library/Frameworks...) instead of the system python.
>
> Following some of the suggestions in this thread and on the sf bug  
> report
>
>  
> https://sourceforge.net/tracker/index.php?func=detail&aid=2831805&group_id=80706&atid=560720
>
> I rebuilt the OSX binaries from scratch, using a src framework build
> of python, and activetcl as suggested by Russell.  The rc2 build
> candidates are at
>
>  http://drop.io/xortel1#
>
> If anyone has a chance to test them, that would be great.

Thank you very much. Unfortunately it doesn't work for me. Trying to  
import pylab results in a bus error (I appended the log in case it has  
anything useful in it).

My configuration:
- Intel Mac
- MacOS X 10.5.7
- Python 2.5.2 (in /Library/Frameworks... from python.org)
- Tcl/Tk 8.4.19 (in /Library/Frameworks... from ActiveState)
- this occurs with or without a ~/.matplotlib/matplotlibrc file (that  
uses TkAgg) and with or without a ~/.matplotlib directory at all
I have confirmed that Tkinter works fine.

I'll see if I can build a binary, though perhaps I should first try  
using a conventional recipe, then if that works, compare it to the  
makefile.

-- Russell

Process: Python [2293]
Path:/Library/Frameworks/Python.framework/Versions/2.5/ 
Resources/Python.app/Contents/MacOS/Python
Identifier:  Python
Version: ??? (???)
Code Type:   X86 (Native)
Parent Process:  bash [2260]

Interval Since Last Report:  346695 sec
Crashes Since Last Report:   8
Per-App Interval Since Last Report:  0 sec
Per-App Crashes Since Last Report:   4

Date/Time:   2009-08-04 20:58:49.631 -0700
OS Version:  Mac OS X 10.5.7 (9J61)
Report Version:  6
Anonymous UUID:  683AF09F-7779-4567-A264-ACBF18B9AB0B

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x
Crashed Thread:  0

Thread 0 Crashed:
0   ??? 00 0 + 0
1   org.python.python   0x0049ed67  
_PyImport_LoadDynamicModule + 153 (importdl.c:54)
2   org.python.python   0x0049ca49 load_module + 201  
(import.c:1758)
3   org.python.python   0x0049cf13 import_submodule + 293  
(import.c:2400)
4   org.python.python   0x0049d161 load_next + 195  
(import.c:2220)
5   org.python.python   0x0049d655 import_module_level +  
213 (import.c:2008)
6   org.python.python   0x0049db05  
PyImport_ImportModuleLevel + 45 (import.c:2072)
7   org.python.python   0x00478917 builtin___import__ + 156  
(bltinmodule.c:49)
8   org.python.python   0x003f8b00 PyObject_Call + 45  
(abstract.c:1861)
9   org.python.python   0x0047d6fe  
PyEval_CallObjectWithKeywords + 112 (ceval.c:3442)
10  org.python.python   0x004806e6 PyEval_EvalFrameEx +  
8542 (ceval.c:2067)
11  org.python.python   0x00484e0e PyEval_EvalCodeEx + 1819  
(ceval.c:2836)
12  org.python.python   0x00484fc2 PyEval_EvalCode + 87  
(ceval.c:500)
13  org.python.python   0x0049be36  
PyImport_ExecCodeModuleEx + 193 (import.c:675)
14  org.python.python   0x0049c28c load_source_module + 726  
(import.c:959)
15  org.python.python   0x0049cf13 import_submodule + 293  
(import.c:2400)
16  org.python.python   0x0049d161 load_next + 195  
(import.c:2220)
17  org.python.python   0x0049d60e import_module_level +  
142 (import.c:2001)
18  org.python.python   0x0049db05  
PyImport_ImportModuleLevel + 45 (import.c:2072)
19  org.python.python   0x00478917 builtin___import__ + 156  
(bltinmodule.c:49)
20  org.python.python   0x003f8b00 PyObject_Call + 45  
(abstract.c:1861)
21  org.python.python   0x0047d6fe  
PyEval_CallObjectWithKeywords + 112 (ceval.c:3442)
22  org.python.python   0x004806e6 PyEval_EvalFrameEx +  
8542 (ceval.c:2067)
23  org.python.python   0x00484e0e PyEval_EvalCodeEx + 1819  
(ceval.c:2836)
24  org.python.python   0x00484fc2 PyEval_EvalCode + 87  
(ceval.c:500)
25  org.python.python   0x0049be36  
PyImport_ExecCodeModuleEx + 193 (import.c:675)
26  org.python.python   0x0049c28c load_source_module + 726  
(import.c:959)
27  org.python.python   0x0049cf13 import_submodule + 293  
(import.c:2400)
28  org.python.python   0x0049d4be ensure_fromlist + 448  
(import.c:2311)
29  org.python.python   0x0049d893 import_module_level +  
787 (import.c:2038)
30  org.python.python   0x0049db05  
PyImport_ImportMod