[Matplotlib-users] 3D Axis : set marker size and color

2009-11-09 Thread luc Estebanez
Dear All,

I am new to the list, so hello everyone !

I am trying to use the new 3D facilities offered by Matplotlib, and I 
can't manage to vary the color and/or size of the markers when doing 3D 
scatter plots :

fig = plt.figure()
ax = Axes3D(fig)
ax.scatter([1,2,3],[3,1,2],[1,2,0],c='r',s=[4,10,20])

The code above doesn't seem to plot anything more than :

ax.scatter([1,2,3],[3,1,2],[1,2,0])

Does anyone have a tip regarding this issue ?

Thanks a lot,
luc

---
luc Estebanez
Graduate Student,
ENS, Paris

--
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] matplot usage in Django

2009-11-09 Thread Oguz Yarimtepe

Hi,

I was trying to use the matplotlib at my Django view. The version i was trying 
is 0.98. What i did is to import the library and then plot a graph. The problem 
is when i tried the "from pylab import *", i got "RuntimeError: could not 
create GdkCursor object". This is most probably because of the apache user is 
not able to access the X server. Indeed at my distro it doesn't have shell 
account.

I don't want to define X access to apache user. So what do you suggest?

-- 
Oguz Yarimtepe 

--
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplot usage in Django

2009-11-09 Thread Michael Droettboom
See this FAQ:

http://matplotlib.sourceforge.net/faq/howto_faq.html#matplotlib-in-a-web-application-server

Mike

On 11/09/2009 09:20 AM, Oguz Yarimtepe wrote:
> Hi,
>
> I was trying to use the matplotlib at my Django view. The version i was 
> trying is 0.98. What i did is to import the library and then plot a graph. 
> The problem is when i tried the "from pylab import *", i got "RuntimeError: 
> could not create GdkCursor object". This is most probably because of the 
> apache user is not able to access the X server. Indeed at my distro it 
> doesn't have shell account.
>
> I don't want to define X access to apache user. So what do you suggest?
>
>


--
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Building basemap on OS X 10.6

2009-11-09 Thread Christopher Barker
Tim Burgess wrote:
> Sodecided to go down the MacPorts path. Many automated downloads 
> later, I now have a successful Basemap install (yay!)
> Many thanks to the folks who have contributed to MacPorts and 
> interestingly geos 3.1.1 is installed.

Is it 64 bit now. If so...


> Only present worry is that wxWidgets port is not building on 10.6 - yet 
> to resolve that.

wxWidgets/wxPython can not be built (for the Mac) 64 bit. It is built on 
Carbon, which Apple has not and will not port to 64 bit. There is a 
Cocoa version of wxMac, but it's not done yet, and has not been wrapped 
for Python.

You may be able to get a 64bit GTK/X11 wxPython working with MacPorts -- 
I've never tried that.


> And FYI, to check whether you have a 64bit Python install:
>  >>> import sys; print sys.maxint
> 9223372036854775807

So it looks like you are running 64 bit -- what a pain this all is.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov

--
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Circular colormaps

2009-11-09 Thread Chloe Lewis
... and for dessert, is there a circular colormap that would work for  
the colorblind?

My department is practicing presenting-science-for-the-general-public,  
and the problems 'heat maps' have for the colorblind keep coming up.

handy: http://konigi.com/tools/submissions/color-deficit-simulators

&C


On Nov 8, 2009, at 3:34 AM, Gary Ruben wrote:

> Hi Ariel,
>
> You might find the attached function helpful here. Try creating a  
> new colormap using the example in the docstring (you could also try  
> setting high=0.8) - basically this will let you turn down the  
> saturation which will hopefully solve your problem. You may also  
> find the plot option useful to see what the individual colour  
> channels are doing if you decide to make a new colormap of your own  
> - you just need to ensure that the r, g, and b values match at both  
> ends.
>
> Gary
>
>
> Ariel Rokem wrote:
>> Hi everyone,
>> I am interested in using a circular colormap, in order to represent  
>> a phase variable, but I don't like 'hsv' (which is circular). In  
>> particular, I find that it induces perceptual distortion, where  
>> values in the green/yellow part of the colormap all look the same.  
>> Are there any circular colormaps except for 'hsv'? If not - how  
>> would you go about constructing a new circular colormap? Thanks,
>> Ariel
>> -- 
>> Ariel Rokem
>> Helen Wills Neuroscience Institute
>> University of California, Berkeley
>> http://argentum.ucbso.berkeley.edu/ariel
> import numpy as np
> import matplotlib.pyplot as plt
> import matplotlib.colors as colors
> import matplotlib._cm as _cm
>
>
> def rescale_cmap(cmap_name, low=0.0, high=1.0, plot=False):
>'''
>Example 1:
>my_hsv = rescale_cmap('hsv', low = 0.3) # equivalent scaling  
> to cplot_like(blah, l_bias=0.33, int_exponent=0.0)
>Example 2:
>my_hsv = rescale_cmap(cm.hsv, low = 0.3)
>'''
>if type(cmap_name) is str:
>cmap = eval('_cm._%s_data' % cmap_name)
>else:
>cmap = eval('_cm._%s_data' % cmap_name.name)
>LUTSIZE = plt.rcParams['image.lut']
>r = np.array(cmap['red'])
>g = np.array(cmap['green'])
>b = np.array(cmap['blue'])
>range = high - low
>r[:,1:] = r[:,1:]*range+low
>g[:,1:] = g[:,1:]*range+low
>b[:,1:] = b[:,1:]*range+low
>_my_data = {'red':   tuple(map(tuple,r)),
>'green': tuple(map(tuple,g)),
>'blue':  tuple(map(tuple,b))
>   }
>my_cmap = colors.LinearSegmentedColormap('my_hsv', _my_data,  
> LUTSIZE)
>
>if plot:
>plt.figure()
>plt.plot(r[:,0], r[:,1], 'r', g[:,0], g[:,1], 'g', b[:,0],  
> b[:,1], 'b', lw=3)
>plt.axis(ymin=-0.2, ymax=1.2)
>
>return my_cmap
> --
> 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-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] add_axes in inches

2009-11-09 Thread Jae-Joon Lee
On Thu, Nov 5, 2009 at 2:31 PM, Thomas Robitaille
 wrote:
> Is there an easy way to add axes to a figure, but specify the 'rect'
> in real rather than relative units? For example, something like:
>

unfortunately no. And I'm not sure if matplotlib will ever going to
support it internally.

However, converting axes coordinates given in inches to the normalized
figure coordinates is not that difficult. And this will work as far as
the figure size does not change after the axes position is calculated
in the normalized figure coordinates.

fig = figure(1)

rect_inches = 0.5, 0.5, 3., 3.

from matplotlib.transforms import Bbox, BboxTransformFrom, TransformedBbox
tr = BboxTransformFrom(Bbox.from_bounds(0, 0, *fig.get_size_inches()))
rect = TransformedBbox(Bbox.from_bounds(*rect_inches), tr).bounds

ax = fig.add_axes(rect)

Note that the axes coordinate need to be recalculated whenever the
figure size changes.

While the axes_grid toolkit has some limited support for fixed size
(in inches) axes, I personally never find it useful.

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

-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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How to make little sparklines

2009-11-09 Thread Tom Leys
Hi

I was asked off list how I created the little sparklines using Matplotlib.

There are two ways I create these:

The live graphs on the demo page (http://your.gridspy.co.nz/powertech/) 
are created by a great little jquery app (so yeah, not matplotlib):
http://omnipotent.net/jquery.sparkline/

To get the data to the browser in order to render the sparkline, you
will need some sort of mechanism similar to Ajax (or at least a form of
it) called Comet. There is a great tutorial on using orbited for this here

http://cometdaily.com/2008/10/10/scalable-real-time-web-architecture-part-2-a-live-graph-with-orbited-morbidq-and-jsio/

If any of you need more help doing that, I am happy to provide some 
source code examples.

If instead, you want to create static line graphs using matplotlib such 
as those on this page:
http://your.gridspy.co.nz/powertech/history/04Nov2009.htm
http://your.gridspy.co.nz/powertech/graph/tiny/3-3-04Nov2009.png?c=2 (an
example)

To render static sparklines I use the following matplot lib code:

def render_simple_line(sensors, resolution = 'hour', span = 1,
   start=None, end=None, fig=None, column=0):
"""Builds a figure that shows the given sensors at the given
resolution and span in the given time period.
"""

if fig is None:
fig=Figure()
fig.set_facecolor('white')
fig.set_edgecolor('white')
axes = fig.add_axes([0.00,0.00,1.0,1.0], axisbg='w', frame_on=False)
axes.set_xticks([])
axes.set_yticks([])
axes.set_axis_off()

if start is None:
start = datetime.datetime.now()
if end is None:
end = start + datetime.timedelta(days=1)
first_date = start.strftime('%Y-%m-%d')
last_date  = end.strftime('%Y-%m-%d')


desc = [("mean", pk) for pk in sensors]
np_table = data_table_matrix(desc, resolution, first_date,
last_date, span )
#note that np_table[0] is datetime objects and [1] is data
if np_table.size == 0:
return None

#replace nulls with 0
np_table[1:][np_table[1:] == np.array([None])] = 0
#replace -ve values
np_table[1:][np_table[1:] < np.array([0])] = 0

axes.xaxis.set_major_formatter(DateFormatter('%H'))
fig.autofmt_xdate()

base = np.zeros(np_table.shape[1])

color = color_list[column % len(color_list)][1]
axes.fill_between(np_table[0], base, np_table[column + 1], facecolor
= color)

return fig

I pass fig in so it is easy to pass a figure from the ipython console,
since ipython makes special figures that are interactive.

-Tom

PS: Dan - I replied to your email directly but it bounced.

--
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Circular colormaps

2009-11-09 Thread Robert Kern
On 2009-11-09 11:46 AM, Chloe Lewis wrote:
> ... and for dessert, is there a circular colormap that would work for
> the colorblind?

Almost certainly not, at least not without compromising other desirable 
features 
for circular colormaps. You could do a circle roughly perpendicular to the 
lines 
of confusion, but this would mean going up and down in lightness, which 
perceptually overemphasizes the light half.

On the other hand, this may not be a bad thing if 0 degrees and/or 180 degrees 
are special as might be the case with phase measurements and other complex 
number-related things.

> My department is practicing presenting-science-for-the-general-public,
> and the problems 'heat maps' have for the colorblind keep coming up.

As a deuteronopic, I heartily thank you for paying attention to these issues.

I've written an application to visualize colormaps in 3D perceptual space as 
well as simulating colorblindness. It uses Mayavi and Chaco, so you will need a 
full Enthought Tool Suite installation:

http://www.enthought.com/~rkern/cgi-bin/hgwebdir.cgi/colormap_explorer/

Of interest for this thread might be the function find_chroma() in hcl_opt.py 
which will, given a lightness value in HCL space, find the largest chroma value 
(roughly similar to saturation) such that a circle at the given lightness value 
will just fit inside of the RGB gamut. A simple maximization on that function 
will find the lightness that gives the largest chroma and hence the largest 
dynamic range of such a colormap. However, it should be noted that I have found 
such colormaps to appear a little washed out and drab. But then, I'm colorblind.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco


--
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] axes_grid divider with room for axis

2009-11-09 Thread Brent Pedersen
hi, i'd like to use the divider stuff in axes_grid to plot a figure
with 2 axes, with xticks on the bottom axis.
in the script pasted below, if i use 0.07 as the min for the y-axis,
then it chops off the top of the plot. if i use 0 as the min, then
it doesn't chop of the top, but it doesnt show the x-axis
ticks/labels. how can i have the divider account for the room needed
for the
labels and ticks?

i've also tried:

hori = [Size.AxesX(axes[0])]
vert = [Size.Scaled(0.3), Size.Scaled(0.7)]
d = Divider(f, rect, hori, vert)

with same problem.
thanks,
-brent


===

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid import make_axes_locatable
import numpy as np
plt.close()


f = plt.figure()
rect = (0, 0.07, 1, 1)
#rect = (0, 0, 1, 1)

ax = f.add_axes(rect, autoscale_on=False, aspect="auto")
divider = make_axes_locatable(ax)
ax2 = divider.new_vertical(size="30%", pad=0.0)

f.add_axes(ax2)
axes = [ax, ax2]


for ax in axes:
ax.plot(np.sin(np.linspace(0, 10, 1600)))
ax.set_xlim(0, 1600)
ax.set_ylim(-1, 1)
axes[1].set_xticks([])

plt.show()

--
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] axes_grid divider with room for axis

2009-11-09 Thread Jae-Joon Lee
On Mon, Nov 9, 2009 at 6:03 PM, Brent Pedersen  wrote:
> how can i have the divider account for the room needed
> for the
> labels and ticks?

Doing this automatically is not straight forward. So you need to
manually adjust the area occupied by the axes.
Note that rect is [left, bottom, width, height] in normalized figure
coordinate. Try something like rect=[0., 0.1, 1., 0.8], or simply use
subplot.

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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] axes_grid divider with room for axis

2009-11-09 Thread Brent Pedersen
On Mon, Nov 9, 2009 at 3:18 PM, Jae-Joon Lee  wrote:
> On Mon, Nov 9, 2009 at 6:03 PM, Brent Pedersen  wrote:
>> how can i have the divider account for the room needed
>> for the
>> labels and ticks?
>
> Doing this automatically is not straight forward. So you need to
> manually adjust the area occupied by the axes.
> Note that rect is [left, bottom, width, height] in normalized figure
> coordinate. Try something like rect=[0., 0.1, 1., 0.8], or simply use
> subplot.

that does it. thanks, i forgot it was height, not ymax.
-brent

>
> 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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plotting single point

2009-11-09 Thread Paul Northug
Greetings,
I would much like to plot single point in existing figure. If the
point is outside of current axes limit, I would like the axes not to
resize.

Is there an easy way? Currently, to add a point x,y, I
scatter([x],[y]) then xlim and ylim to make sure the axes did not
rescale.

Pål

--
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem with simple use of draw() in animations of arrays

2009-11-09 Thread David Sanders
On Mon, Nov 2, 2009 at 11:51 PM, Jae-Joon Lee  wrote:

> On Mon, Nov 2, 2009 at 10:52 PM, David Sanders 
> wrote:
> > from pylab import *
> >
> > ion()
> >
> > N = 1000
> > pos = zeros((N,2))
> >
> > figure(figsize=(8,8))
> > points, = plot(pos[:,0], pos[:,1], ',')
> > axis([-20,20,-20,20])
> >
> > for t in range(1000):
> >
> > pos += uniform(-1,1,N*2).reshape(N,2)
> > points.set_data(pos[:,0].copy(), pos[:,1].copy())
> > draw()
>
> The Line2D object keeps the input data as a cache and only update it
> (recache) if the new data is different than the cached one.
> The problem in this particular case is that the cache is actually a
> *pos* itself. And modifying the pos in place, actually modify the
> cache in the Line2D object. Thus, set_data sees that the given data is
> identical to the cached one, and skip the recaching.
> I'm not sure what is the best approach here, and I defer the fix (or
> not) to others.
> Meanwhile, you can force the recaching with recache method. i.e., call
> points.recache() after set_data. You don't need to make a copy also.
> As a matter of fact, I think it will give you a best performance (but
> not tested) if you directly update the cached data and do not call
> set_data.
> Note that in this particular case, pos == cache, so you actually don't
> need to call get_data, but this is not a general case.
>
> posx, posy = points.get_data(orig=True)
>
> for t in range(100):
>dx, dy = uniform(-1,1,N*2).reshape(2, N) # note the change in the shape
>posx += dx
>posy += dy
>points.recache()
>draw()
>
>
Dear JJ,

Many thanks for your answer -- "points.recache()" is exactly what I was
looking for to make my animations work.

It seems to me that this must be a reasonably common question, but I could
not find it in the documentation.
Perhaps it could be added to the animation cookbook?

Thanks and best wishes,
David.

PS: Apologies for the late reply -- I was travelling with difficult internet
access.
--
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Py2app application with matplotlib fails on OS X 10.6

2009-11-09 Thread Brian Zambrano
I'm getting my Py2app build running and think I've worked around some
issues, but another major one has come up.  My application is being built on
OS X 10.5.8, where matplotlib is, oviously, installed.  On another 10.5.X
machine without any of the app's dependencies, my compiled app runs just
fine.  Today, I tried getting it running on a new Mac with Snow Leopard,
10.6, and get the following bus error.

>From the crash report, it looks like these are relevant:

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   ??? 00 0 + 0
1   libSystem.B.dylib   0x91176aa8
_Unwind_GetLanguageSpecificData + 24
2   libstdc++.6.dylib   0x90057d86 __gxx_personality_v0 +
120
3   libgcc_s.1.dylib0x03801476 _Unwind_Backtrace + 278
4   libgcc_s.1.dylib0x03801890 _Unwind_Resume + 112
5   ft2font.so  0x038cd3b1
FT2Font::FT2Font(std::string) + 3737
6   ft2font.so  0x038cd4df
ft2font_module::new_ft2font(Py::Tuple const&) + 291
7   ft2font.so  0x038d787f
Py::ExtensionModule::invoke_method_varargs(std::string
const&, Py::Tuple const&) + 261
8   ft2font.so  0x038df637
method_varargs_call_handler + 301

I'm not really sure where to go from here.  I've read a few other things
which hint at Snow Leopard being a bit of a headache: http://bit.ly/2Z2Cil

Has anyone run this setup before?  Suggestions?

BZ
--
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Py2app application with matplotlib fails on OS X 10.6

2009-11-09 Thread Emanuele Santos

We saw the same problem with VisTrails (www.vistrails.org).

It seems that python.org's python can't build the fonts in  
~/.matplotlib on snow leopard.
We noticed that importing matplotlib.axis using Apple's python will do  
that.


So this is the work-around we found for vistrails (bundled with python.org 
 2.5)


In a terminal on snow leopard:

$ rm -rf ~/.matplotlib
$ cd /Applications/Vistrails.app/Contents/Resources/lib/python2.5
$ DYLD_LIBRARY_PATH=/usr/lib  /System/Library/Frameworks/ 
Python.framework/Versions/2.5/bin/python


>>> import matplotlib.axis

Now running the app again works.

The DYLD_LIBRARY_PATH is necessary because of problems we saw with  
different versions of libgcc_s.1.dylib present in the system and the  
wrong one was being loaded.


I don't think it's a py2app bug because I can reproduce it by just  
running python.org's python and importing matplotlib.axis.


I guess it is a bug in matplotlib.

-- Emanuele.


On Nov 9, 2009, at 11:46 PM, Brian Zambrano wrote:

I'm getting my Py2app build running and think I've worked around  
some issues, but another major one has come up.  My application is  
being built on OS X 10.5.8, where matplotlib is, oviously,  
installed.  On another 10.5.X machine without any of the app's  
dependencies, my compiled app runs just fine.  Today, I tried  
getting it running on a new Mac with Snow Leopard, 10.6, and get the  
following bus error.


From the crash report, it looks like these are relevant:

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   ??? 00 0 + 0
1   libSystem.B.dylib   0x91176aa8  
_Unwind_GetLanguageSpecificData + 24
2   libstdc++.6.dylib   0x90057d86  
__gxx_personality_v0 + 120
3   libgcc_s.1.dylib0x03801476 _Unwind_Backtrace  
+ 278
4   libgcc_s.1.dylib0x03801890 _Unwind_Resume +  
112
5   ft2font.so  0x038cd3b1 FT2Font::FT2Font 
(std::string) + 3737
6   ft2font.so  0x038cd4df  
ft2font_module::new_ft2font(Py::Tuple const&) + 291
7   ft2font.so  0x038d787f  
Py::ExtensionModule::invoke_method_varargs 
(std::string const&, Py::Tuple const&) + 261
8   ft2font.so  0x038df637  
method_varargs_call_handler + 301


I'm not really sure where to go from here.  I've read a few other  
things which hint at Snow Leopard being a bit of a headache: http://bit.ly/2Z2Cil


Has anyone run this setup before?  Suggestions?

BZ

--
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users






--
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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users