[Matplotlib-users] Creating custom markers as the union of complex vertices

2017-07-12 Thread Eric Emsellem

Hi

I have been looking for an elegant/simple (working!) solution to create 
new complex markers for matplotlib.


For example, I would like to design a new marker which is the union of a 
set of vertices, for example (just an example), two petals which are 
symmetric (see verts1 and verts2) and two lines above and below (see 
verts3, and verts4). I would also like to have the petal possibly filled 
(or not) and the edgecolor of each vertices with possibly various 
colours (one petal is blue, the other is orange). How should I proceed?


A naive way forward is to do something like (for a double petal, the 
left one not being filled up, the right one being filled, see the 
definition for verts1, verts2, verts3, verts4 below):


## Code
x = rand(10)
y = rand(10)
verts = [verts1, verts2, verts3, verts4]
fc = ['k', 'None', 'None', 'None']
ec = ['b', 'orange', 'k', 'k']

for lverts, lfc, lec in list(zip(verts, fc, ec)) :
 scatter(x, y, marker= (lverts, 0), facecolor=lfc, edgecolor=lec, 
s=1000, label='My symbol')


==> HOWEVER, since these are done in a for loop, it is not considered as 
a single marker when I do, for example, :


legend(loc=0)

QUESTION: how should I manage this? (couldn't find the answer on the net)

Suggestion are most welcome!

Thanks!
Eric
==
## Definition for the vertices
if 1:
# verts1:
size, angrad = 10., 0.
rx = 4. * size
theta = np.linspace(-pi / 4., pi / 4., 151)
x = rx*np.sqrt(cos(2.*theta))*cos(theta)
y = rx*np.sqrt(cos(2.*theta))*sin(theta)
rotx = x * cos(angrad) + y * sin(angrad)
roty = -x * sin(angrad) + y * cos(angrad)
verts1 = list(zip(rotx,roty))

# verts2:
size, angrad = 10.,  np.pi
rx = 4. * size
theta = np.linspace(-pi / 4., pi / 4., 151)
x = rx*np.sqrt(cos(2.*theta))*cos(theta)
y = rx*np.sqrt(cos(2.*theta))*sin(theta)
rotx = x * cos(angrad) + y * sin(angrad)
roty = -x * sin(angrad) + y * cos(angrad)
verts2 = list(zip(rotx,roty))

# verts3
verts3 = list(zip([0.,0.],[0,0.1]))

# verts4
verts4 = list(zip([0.,0.],[-0.1,-0.03]))

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] four colour theorem

2012-01-27 Thread Eric Emsellem
Dear all,

I have a set of Voronoi bins, defined by nodes (x,y) and an underlying 
mesh of squared bins.
See an example here of such Voronoi bins.

http://www.google.fr/imgres?q=voronoi+binninghl=frsa=Xbiw=1280bih=665tbm=ischprmd=imvnsbtbnid=zp0RRIktKlF9pM:imgrefurl=http://www.aanda.org/articles/aa/full/2007/09/aa4621-05/aa4621-05.right.htmldocid=CeAk6FN_pZDa5Mimgurl=http://www.aanda.org/articles/aa/full/2007/09/aa4621-05/img26.gifw=532h=1087ei=ZmYiT-Z7xYDyA9ew0acMzoom=1iact=rcdur=164sig=112304340793152029504page=4tbnh=151tbnw=74start=63ndsp=25ved=1t:429,r:1,s:63tx=58ty=65

So basically each node, (x,y) would define a Voronoi bin made of a set 
of squared pixels. So one node would correspond to for example N squared 
pixels:

node[i] = [(x1,y1),(x2,y2),...(xN,yN)]

I want now to create an imshow like plot of these bins by using the four 
colour theorem, meaning that I would use 4 colours and want adjacent 
Voronoi bins not to have the same colour.

Is there a simple way to do this in matplotlib? I couldn't find much on 
the web so far.

thanks!
Eric


--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Unknown projection '3d' even with svn version?

2010-11-18 Thread Eric Emsellem
Ok problem(s) solved, thanks a lot for the efficient help (this also taught me 
how to go through the code more thoroughly)

* for the record: I had a pylab.py in the site-packages directory, probably a 
left-over from some other installation, which was interfering with the pylab.py 
which should be the one under matplotlib/. I just removed it now and it works 
well.

* and you were right, the funny try this was a left over of many tests I had 
done to track down the problem (mea culpa on that one)

thanks again, all works beautifully (and consistently) now.

cheers
Eric

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2  L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Unknown projection '3d' even with svn version?

2010-11-17 Thread Eric Emsellem
yes, it looks like this is the right file (when I look at matplotlib.__file__)

Now tracing which routines are run when doing this, it looks like it looks for
projection in projections/__init__.py
after going through line 675 of figure.py

It looks like add_subplot of plt.figure() is not compatible in my matplotlib.

Eric

 Strange indeed.  Ok, what does matplotlib.__file__ say?  Does the
 filename match the path you are expecting?  At this point, I would also
 try putting print statements in the register code at the end of
 axes3d.py to see if that code path gets executed (can't see why not).
 
 Ben Root


--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2  L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Unknown projection '3d' even with svn version?

2010-11-17 Thread Eric Emsellem
Dear Ben
thanks a lot for this thoughful answer.


When I use only ipython and not ipython -pylab IT WORKS!!!

So this is a problem with ipython -pylab call...
Any thought of why this is?

I provide more info below

thanks for any help there.

Eric

P.S.: Here is the output of my setup:

In [1]: matplotlib.__file__
Out[1]: '/usr/lib64/python2.6/site-packages/matplotlib/__init__.pyc'

In [6]: mpl_toolkits.mplot3d.__file__
Out[6]: '/usr/lib64/python2.6/site-packages/mpl_toolkits/mplot3d/__init__.pyc'

A funny one is that I have to import mpl_toolkits first and then mplot3d, and
when I do this I get:
In [5]: from mpl_toolkits import mplot3d
try this

I am not sure the try this is meant to be there


P.P.S.:
Here is my detailed setup when I do ipython -pylab

matplotlib data path /usr/lib64/python2.6/site-packages/matplotlib/mpl-data
matplotlib version 1.0.0
verbose.level helpful
interactive is False
units is False
platform is linux2
Your PyGtk has set_interactive(), so you can use the
more stable single-threaded Gtk mode.
See https://bugs.launchpad.net/ipython/+bug/270856

backend GTKAgg version 2.17.0
Python 2.6.5 (r265:79063, Jul  5 2010, 11:46:13)


IPython 0.10 -- An enhanced Interactive Python.

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2  L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Unknown projection '3d' even with svn version?

2010-11-16 Thread Eric Emsellem
Hi,

I have just installed the svn version of matplotlib and basemap + numpy from 
the 
svn repository of
http://download.opensuse.org/repositories/home:/ocefpaf/openSUSE_11.3/x86_64/

When I do:
===
ipython -pylab
(matplotlib 1.0.0, backend GTKAgg version 2.17.0, openSuse 11.3 x86_64)

import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

I get a

ValueError: Unknown projection '3d'

I did the upgrade to the svn version because the previous one (which was 
already 
1.0) gave me the same message...

what's wrong here?
(looked at the web and couldn't find out a good solution, beyond the upgrade I 
did)

thanks in advance
Eric


--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2  L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Unknown projection '3d' even with svn version?

2010-11-16 Thread Eric Emsellem
Dear Ben

thanks a lot for the quick reply.

I did that (and read some posts on the web) but no luck, as it says:

1.0.0

I in fact just went back to my openSuse 11.3 (Science repo) version because it 
went really wrong with scipy etc and I didn't want to mess up my setup. But 
still the same message with the Unknown projection.

I have checked the axes3d.py in my mpl_toolkits and it has the name = '3d' at 
the beginning and the register at the end...

???

Eric

 Could you please execute the following:

 import matplotlib
 print matplotlib.__version__

 and report back what it says?  I suspect that when you installed the svn
 version, the original version of matplotlib is still getting loaded.
 The projection='3d' feature is brand new to 1.0.0.

 Ben Root

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2  L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] segmentation fault..

2010-10-01 Thread Eric Emsellem
Hi

I just upgraded to opensuse 11.3.

And I get now:

ipython -pylab:

matplotlib version 1.0.0
verbose.level helpful
platform is  linux2
*Segmentation fault*


Any clue?

I am using IPython 0.10, Python 2.6.5

Eric


--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] MPL = Location of new figure on desktop

2010-08-20 Thread Eric Emsellem
Hi

I have one very nagging issue which I would like to solve with matplotlib once 
and for all: this may have to do with my desktop windown manager but I couldn't 
find much there, so any input is welcome.

When I open a new figure, the figure ALWAYS comes BELOW my current xterm (using 
KDE 4.3) and ALWAYS in the wrong place (top left corner where I usually put 
other windows). I would like some smart location for that figure so I don't 
have systematically to get it up and move it when I open a new figure. Is this 
linked to matplotlib? (this is the only application which is not managed 
properly in this context). I am using ipython -pylab as a working context (on 
opensuse 11.2).

thanks and cheers

Eric

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] MPL = Location of new figure on desktop

2010-08-20 Thread Eric Emsellem
Hi

thanks a lot for the feedback.

Just tested with Qt4Agg and the window is coming up in the right location (just 
below my xterm where there is still space for a new window) now, and sometimes 
on TOP, but also sometimes at the BOTTOM I was using WxAgg before.

So it seems it is backend dependent at least with me (0.99). If this is 
confirmed I am ok for the moment to use Qt4Agg (if this does not impact other 
functionalities) as at least it seems to deal with the location in a better 
way. 
It would be better if really the link with the WM works better of course.

Eric

 That is exactly what I am thinking now that we know that it happens even
 with the Qt4Agg backend.  Should these hints be given by the objects in
 backend_bases (for a consistent behavior), or do they have to be done by
 the individual backends?  Maybe the hints could be stored as rcParams
 for all backends to refer to

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] version of numpy for matplotlib: wrong test in setupext.py

2010-04-28 Thread Eric Emsellem
Hi

I just downloaded numpy 2.0 and there is a test in the setupext.py of 
matplotlib 
which says:

 nn = numpy.__version__.split('.')
 if not (int(nn[0]) = 1 and int(nn[1]) = 1):

This clearly does NOT work for numpy 2.0.0 since nn[1] is 0
Please change this.

Eric

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] new marker: how to make a spiral

2010-01-30 Thread Eric Emsellem
Hi

I am using verts in the matplotlib scatter function and managed to
create many new symbols for scatter plots. One I cannot make is a
spiral-like symbol (logarithmic spiral) because it does connect the
first and last point of the verts series of x,y points I am defining. Is
there a way to avoid that? (so that the spiral-curve stays open)

thanks!

Eric

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib CRASHes when saving as a postscript file

2010-01-09 Thread Eric Emsellem
Hi
thanks A LOT for taking the time to test this and for the suggestions.

Yes, pcolormesh is needed (or at least I think) because in the real
example (the figures I am trying to make) the pixels are rotated meaning
that these are polygons which are not aligned with the axes. Imshow
cannot do that as far as I can tell because it shows a rectangular grid
(masked or not) aligned with the axis.

It seems indeed linked with the number of plots/memory. I have tested
this now and looked for when it crashes, Limiting the number of rows to
1, 2 , 3 etc. With 3 rows (9 plots) it works. But it crashes when I
include 4 rows. Looking at a top and memory usage, it is clearly a pb
with ghostscript when it takes over to transform it into the eps. Here
is the line from the top when it crashes:

  PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+  COMMAND
 5980 emsellem  20   0  167m  88m 4352 R  100  2.3   0:54.45 gs

When gs go over ~170m, it crashes. Not clue why. I have ample memory
left (2Gb RAM, 2Gb Swap) and no pb of disk space.

As for the workarounds: yes I did a pdf2ps already for one urgent figure
I had to get. I just hoped that I wouldn't have to do that for all my
figures.

Never used rasterization before...
(and thanks for pointing out the mistake on map3, this came after
adapting the script for this post). I guess this means you transform it
into a resolution dependent figure. I can try it but I am afraid this
will look quite bad.

cheers
Eric


On 09/01/10 04:25, Jae-Joon Lee wrote:
 I can reproduce this error with the current svn.
 
 I doubt if this is a matplotlib issue, because it works fine if the
 number of axes is small.
 To me, it seems as some memory error in the ghostscript, but my quick
 googling did not show any relevant information.
 So, I hope some postscript expert take a look at the issue.
 
 However, note that pcolormesh in backends other than agg is extremely
 inefficient, and I strongly discourage its use in other backends.
 Your current example could be much efficient if you simply can use
 imshow. Do you have to use pcolormesh? Your current example seems to
 be easily convertible to imshow, but you original example may not.
 
 In case the use of pcolormesh is not avoidable, I can think of two 
 workarounds.
 
 1) save as pdf first then convert to eps. Saving as pdf will take as
 much time as saving as ps.
 
 2) Save as eps but rasterize the pcolormesh plots. This is my choice
 and saving time is also not very long. As a matter of fact, whenever
 pcolormesh is used, I strongly recommend to consider rasterizing it.
 
 For your current script, you may add something like below at the end
 of your for-loop.
 
   map1.set_zorder(0.5)
   map2.set_zorder(0.5)
   map3.set_zorder(0.5)
   ax1.set_rasterization_zorder(0.6)
   ax2.set_rasterization_zorder(0.6)
   ax3.set_rasterization_zorder(0.6)
 
 This code needs to be inside the for-loop so that all the pcolormesh
 plots get rasterized.
 Also, note that, in your current script, the third pcolormesh plot is
 assigned to map2, instead of map3, so you need to fix this first.

-- 
=
Eric Emsellem   European Southern Observatory
Karl-Schwarzschild Str. 2
e-mail: eemse...@eso.org  85748 Garching bei Muenchen
tel: +49 (0)89 3200 6914  Germany
fax: +49 (0)89 3200 6480
=

--
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] matplotlib CRASHes when saving as a postscript file

2010-01-09 Thread Eric Emsellem
Thinking about it: when matplotlib transfer the plot to ghostscript, is
there a parameter in the call for gs which limits the memory usage???
It seems that this is discussed in some posts about gs

Eric

On 09/01/10 04:25, Jae-Joon Lee wrote:
 I can reproduce this error with the current svn.
 
 I doubt if this is a matplotlib issue, because it works fine if the
 number of axes is small.
 To me, it seems as some memory error in the ghostscript, but my quick
 googling did not show any relevant information.
 So, I hope some postscript expert take a look at the issue

--
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] matplotlib CRASHes when saving as a postscript file

2010-01-07 Thread Eric Emsellem
Hi

I finally managed to write a simplified version of my python script
which crashes when trying to save the figure as a postscript file. (this
is related to a previous post). See below. The script is provided, as
well as the full error message.

Sorry for the long script, but basically I am plotting 3x7 arrays via
pcolormesh. The script looks pretty dum because it was adapted from a
more complicated one where the bins/pixels are not exactly squared and
are rotated. In the version below I have tried to remove the unncessary
complication. And I get a failure from ghostscript when I try to save it
as eps. It works when I save it as a png.

Can anyone tell me what's wrong there? Again I am using:

### On an OpenSuse 11.2, 64b
xpdf distiller (but I tried others).
matplotlib 0.99.1.1
backend WXAgg version 2.8.10.1
Python 2.6.2 (r262:71600, Oct 24 2009, 03:15:21)
IPython 0.10 -- An enhanced Interactive Python.


THANKS
Eric


##
# Script to run which crashes when saving the figure as an eps file
##
#!/usr/bin/python
import numpy as num
import pylab as pl

def  pos(i,j, w, h) :
   return [0.05+ j*(w+0.02), 0.99 -  (i+1)*(h+0.023)+0.025, w, h]


## Opening the figure
## Figure
pl.figure(1, figsize=(5*1.2, 7*1.5))
fig = pl.gcf()
pl.clf()

## Size of figure
figH = fig.get_figheight()
figW = fig.get_figwidth()
w = 0.99 / 3. -0.03
h =  0.99 / 7 - 0.022

## List of data to plot (I take 7 times the same stuff)
listgal = [1,2,3,4,5,6,,7]

## Initialisation of start, end and step
ngal = len(listgal)
start = [-30.,-30.]
end = [30.,30.]
npix = [80,80]
x = num.linspace(start[0],end[0], npix[0])
y = num.linspace(start[1],end[1], npix[1])
step = [x[1]-x[0], y[1]-y[0]]
X,Y = num.meshgrid(x,y)

## Initialisation of data
data = num.random.random((npix[0], npix[1]))

pl.ioff()
for k in range(ngal) :
   gal = listgal[k]

   ## Coordinates

   ## Grid for rotation
   Xp,Yp = X - step[0]/2., Y - step[1]/2.
   X1,Y1 = X+step[0]/2.,Y+step[1]/2.
   X2,Y2 = X-step[0]/2.,Y+step[1]/2.
   X3,Y3 = X-step[0]/2.,Y-step[1]/2.
   X4,Y4 = X+step[0]/2.,Y-step[1]/2.
   minXc = num.min(num.concatenate((X1,X2,X3,X4)))
   maxXc = num.max(num.concatenate((X1,X2,X3,X4)))
   minYc = num.min(num.concatenate((Y1,Y2,Y3,Y4)))
   maxYc = num.max(num.concatenate((Y1,Y2,Y3,Y4)))
   dX = maxXc - minXc
   dY = maxYc - minYc

   ## Deriving the right aspect ratio etc
   aspectIma = dX / dY
   aspectFig = figW / figH
   aspectWin = w / h
   if (aspectIma  aspectWin*aspectFig) :
  maxXc = maxXc * aspectFig * aspectWin / aspectIma
  minXc = minXc * aspectFig * aspectWin / aspectIma
   else :
  maxYc = maxYc * aspectIma / (aspectFig * aspectWin)
  minYc = minYc * aspectIma / (aspectFig * aspectWin)
   extentR = minXc, maxXc, minYc, maxYc

   cmap = pl.cm.jet
   minI, maxI = 0., 1.
   cmap.set_bad('w',1.0)
   j = 0
   ax1 = fig.add_axes(pos(k,j, w, h))
   map1 = ax1.pcolormesh(Xp,Yp,data,shading='flat',vmin=minI,vmax=maxI,
cmap=cmap)
   pl.plot([0.],[0.],'k+', markersize=10, lw=3)
   xticklabels = pl.getp(pl.gca(), 'xticklabels')
   pl.setp(xticklabels, fontsize=8)
   yticklabels = pl.getp(pl.gca(), 'yticklabels')
   pl.setp(yticklabels, fontsize=8)
   pl.axis(extentR)
   j += 1

   ax2 = fig.add_axes(pos(k,j, w, h))
   map2 = ax2.pcolormesh(Xp,Yp,data,shading='flat',vmin=minI,vmax=maxI,
cmap=cmap)
   pl.plot([0.],[0.],'k+', markersize=10, lw=3)
   pl.axis(extentR)
   ax2.set_yticks([])
   xticklabels = pl.getp(pl.gca(), 'xticklabels')
   pl.setp(xticklabels, fontsize=8)
   pl.text(0.02,0.96, %4.0f/%4.0f%(minI,maxI),
verticalalignment='top',rotation='vertical',transform = ax2.transAxes,
fontsize=8)
   j += 1

   ax3 = fig.add_axes(pos(k,j, w, h))
   map2 = ax3.pcolormesh(Xp,Yp,data,shading='flat',vmin=0.,vmax=1.,
cmap=cmap)
   pl.plot([0.],[0.],'k+', markersize=10, lw=3)
   pl.axis(extentR)
   ax3.set_yticks([])
   xticklabels = pl.getp(pl.gca(), 'xticklabels')
   pl.setp(xticklabels, fontsize=8)
   pl.text(0.02,0.96, %4.0f/%4.0f%(minI,maxI),
verticalalignment='top',rotation='vertical',transform = ax3.transAxes,
fontsize=8)
   j += 1
   pl.text(0.92,0.5, gal,
rotation='vertical',verticalalignment='center',transform = ax3.transAxes)

   k += 1

pl.ion()
pl.show()

###
## ERROR MESSAGE WHEN DOING:
## savefig(tmp.eps)

savefig(toto.eps)
Error: /limitcheck in --def--
Operand stack:
   pa_c2c   --nostringval--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--
--nostringval--   2   %stopped_push   --nostringval--   --nostringval--
  --nostringval--   false   1   %stopped_push   1878   1   3
%oparray_pop   1877   1   3   %oparray_pop   1861   1   3   %oparray_pop
  1755   1   3   

[Matplotlib-users] Problems generating postscript!

2010-01-02 Thread Eric Emsellem
Hi

I am having reccurrent problem generating postscript files using savefig.

I am basically generating a figure with lots of small thumbnail images
(loaded with mpl pcolormesh and contour) and some overimposed text.

When I do:
savefig(myfig.eps)

it takes quite a while, and makes rather big figures ( 20 Mb). But then
I cannot load that eps file anymore with any of the software I have
tried (okular, display, gimp...). The file seems corrupted and when I
e.g. try with display it tells me:


   Error: /limitcheck in --def--
   Operand stack:
  p1c_37d   --nostringval--
   Execution stack:
  %interp_exit   .runexec2   --nostringval--   --nostringval--
 --nostringval--   2   %stopped_push   --nostringval--   --nostringval--
  --nostringval--   false   1   %stopped_push   1878   1   3
%oparray_pop   1877   1   3   %oparray_pop   --nostringval--   1861   1
  3   %oparray_pop   1755   1   3   %oparray_pop   --nostringval--
%errorexec_pop   .runexec2   --nostringval--   --nostringval--
--nostringval--   2   %stopped_push   --nostringval--
   Dictionary stack:
 --dict:1172/3371(ro)(G)--   --dict:0/20(G)--
--dict:75/200(L)--   --dict:65534/65534(L)--
   Current allocation mode is local
   Last OS error: 2
   Current file position is 14073283
   GPL Ghostscript 8.64: Unrecoverable error, exit code 1


Any help with this please!?

THANKS!

Eric
#
# Some info on my config here
#
# OS is OpenSuse 11.2 with KDE, 64b laptop

matplotlib version 0.99.1.1
verbose.level helpful
interactive is False
units is False
platform is linux2
backend WXAgg version 2.8.10.1
Python 2.6.2 (r262:71600, Oct 24 2009, 03:15:21)
IPython 0.10 -- An enhanced Interactive Python.

# And in my matplotlibrc:
usetex False
ps.papersize  : A4
ps.useafm : False
ps.usedistiller   : None
ps.distiller.res  : 120  # dpi
ps.fonttype   : 3

--
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] Problem generating postscript

2009-12-30 Thread Eric Emsellem
Hi again

regarding my last post, I still have pb generating simple eps files.
Now I turned on usetex to True and I get the message given below. If
anyone can help me with this, it would be great since I am now stuck
with this.

Reminder: the pb occurs when I save a figure (savefig) in postscript
format (.eps), after plotting a number of small thumbnail images (using
pcolormesh and contour).

cheers

Eric
===
GPL Ghostscript 8.64: Unrecoverable error, exit code 1
---
RuntimeError  Traceback (most recent call last)

/home/science/ATLAS3D/python/Analysis/show_maps.py in module()
 1
  2
  3
  4
  5

/usr/lib64/python2.6/site-packages/matplotlib/pyplot.pyc in
savefig(*args, **kwargs)
354 def savefig(*args, **kwargs):

355 fig = gcf()

-- 356 return fig.savefig(*args, **kwargs)

357 if Figure.savefig.__doc__ is not None:

358 savefig.__doc__ = dedent(Figure.savefig.__doc__)


/usr/lib64/python2.6/site-packages/matplotlib/figure.pyc in
savefig(self, *args, **kwargs)
   1030 patch.set_alpha(0.0)

   1031

- 1032 self.canvas.print_figure(*args, **kwargs)

   1033

   1034 if transparent:


/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_wxagg.pyc
in print_figure(self, filename, *args, **kwargs)
 98 def print_figure(self, filename, *args, **kwargs):

 99 # Use pure Agg renderer to draw


-- 100 FigureCanvasAgg.print_figure(self, filename, *args,
**kwargs)
101 # Restore the current view; this is needed because the


102 # artist contains methods rely on particular attributes


/usr/lib64/python2.6/site-packages/matplotlib/backend_bases.pyc in
print_figure(self, filename, dpi, facecolor, edgecolor, orientation,
format, **kwargs)
   1474 orientation=orientation,


   1475 bbox_inches_restore=_bbox_inches_restore,


- 1476 **kwargs)


   1477 finally:


   1478 if bbox_inches and restore_bbox:



/usr/lib64/python2.6/site-packages/matplotlib/backend_bases.pyc in
print_eps(self, *args, **kwargs)
   1327 from backends.backend_ps import FigureCanvasPS # lazy
import
   1328 ps = self.switch_backends(FigureCanvasPS)

- 1329 return ps.print_eps(*args, **kwargs)

   1330

   1331 def print_pdf(self, *args, **kwargs):


/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_ps.pyc in
print_eps(self, outfile, *args, **kwargs)
853

854 def print_eps(self, outfile, *args, **kwargs):

-- 855 return self._print_ps(outfile, 'eps', *args, **kwargs)

856

857


/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_ps.pyc in
_print_ps(self, outfile, format, *args, **kwargs)
882 self._print_figure_tex(outfile, format, imagedpi,
facecolor, edgecolor,
883orientation, isLandscape,
papertype,
-- 884**kwargs)

885 else:


886 self._print_figure(outfile, format, imagedpi,
facecolor, edgecolor,


/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_ps.pyc in
_print_figure_tex(self, outfile, format, dpi, facecolor, edgecolor,
orientation, isLandscape, papertype, **kwargs)



   1191 elif rcParams['text.usetex']:


   1192 if False: pass # for debugging


- 1193 else: gs_distill(tmpfile, isEPSF, ptype=papertype,
bbox=bbox)

   1194


   1195 if  isinstance(outfile, file):



/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_ps.pyc in
gs_distill(tmpfile, eps, ptype, bbox)
   1311 fh = file(outfile)

   1312 if exit_status: raise RuntimeError('ghostscript was not able
to process \
- 1313 your image.\nHere is the full report generated by
ghostscript:\n\n' + fh.read())
   1314 else: verbose.report(fh.read(), 'debug')


   1315 fh.close()



RuntimeError: ghostscript was not able to process your image.
Here is the full report generated by ghostscript:

GPL Ghostscript 8.64 (2009-02-03)
Copyright (C) 2009 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file COPYING for details.
Loading NimbusSanL-Regu font from
/usr/share/ghostscript/8.64/Resource/Font/NimbusSanL-Regu... 3968216
1927802 6785440 4864692 1 done.
Loading CenturySchL-Roma font from
/usr/share/ghostscript/8.64/Resource/Font/CenturySchL-Roma... 4008424
2092670 6785440 4877110 1 done.
Error: /limitcheck in --def--
Operand stack:
   p1c_37d   --nostringval--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--
--nostringval--   2   %stopped_push   --nostringval--   --nostringval--
  --nostringval--   false   1   %stopped_push   1878   1   3
%oparray_pop   1877   1   3   

[Matplotlib-users] Colours of histograms?

2009-12-30 Thread Eric Emsellem
Hi

how do I specify the colour of the bars in an histogram done with more than one 
set of data?

Example:

x1 = random(1000)
x2 = random(1000)

hist([x1,x2], c=['r','b'])

does not work...

I have tried with rgba sequences but no luck there. The help of hist
 color: matplotlib color arg or sequence of rgba tuples 

so I guess we can specify the individual colours of each set of bars (one 
colour 
per dataset) no?

thanks.

Eric

--
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] Problem generating postscript

2009-12-30 Thread Eric Emsellem
Hi
thanks a lot for the quick tip. But no xpdf does not do it (I had tried it).

Just to be consistent below is an account of my config (may not help
much). I'll tried to write some simple script to reproduce the bug and
post it but I am afraid this won't be very simple on my side.

cheers
Eric
==
# OS is OpenSuse 11.2 with KDE, 64b laptop

matplotlib version 0.99.1.1
verbose.level helpful
interactive is False
units is False
platform is linux2
backend WXAgg version 2.8.10.1
Python 2.6.2 (r262:71600, Oct 24 2009, 03:15:21)
IPython 0.10 -- An enhanced Interactive Python.

# And in my matplotlibrc:
usetex False
## tried usetex True too
ps.papersize  : A4
ps.useafm : False
ps.usedistiller   : None
## I tried all possible distiller... didn't change the pb.
ps.distiller.res  : 120  # dpi
ps.fonttype   : 3
==

On 30/12/09 20:35, Jae-Joon Lee wrote:
 This is a kind of bug that is quite hard to trace unless we can
 reproduce the error.
 
 As far as I know, there has been a report that matplotlib does not
 work well with GPL Ghostscript 8.63. And I'm not sure if it is
 related.
 
 http://old.nabble.com/Segmentation-fault-with-EPS-output-on-matplotlib-%3D0.98.5.2-to25257581.html#a25334270
 
 So, see if using xpdf as a distiller works.


-- 
=
Eric Emsellem   European Southern Observatory
Karl-Schwarzschild Str. 2
e-mail: eemse...@eso.org  85748 Garching bei Muenchen
tel: +49 (0)89 3200 6914  Germany
fax: +49 (0)89 3200 6480
=

--
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] Colours of histograms?

2009-12-30 Thread Eric Emsellem
great. Thanks! I had a look at the thumbnails but didn't find the one
you point out. (And the doc is confusing)

Thanks!

and yes, very weird behaviour when the two arrays have the same length...

Eric

On 30/12/09 19:53, Jae-Joon Lee wrote:
 x1 = random(1000)
 x2 = random(1000)
 
 n, bins, patches = hist(np.array([x1, x2]).transpose())
 
 plt.setp(patches[0], color=r)
 plt.setp(patches[1], color=b)
 
 also see
 
 http://matplotlib.sourceforge.net/examples/pylab_examples/hist_colormapped.html

--
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] Error when running code on remote machine: how can I overpass this?

2008-12-30 Thread Eric Emsellem
Hi,

I am trying to run a relatively large code, which includes some calls to and
import from pylab/matplotlib, on a remote machine: the part of the code I am
running is NOT performing any plot so there is no direct access to a display.
Unfortunately it still crashes with something like:

--- 40 cursors.MOVE  : gdk.Cursor(gdk.FLEUR),
 41 cursors.HAND  : gdk.Cursor(gdk.HAND2),
 42 cursors.POINTER   : gdk.Cursor(gdk.LEFT_PTR),

RuntimeError: could not create GdkCursor object

when it tries to reach the display when importing pylab I guess.

I am now doing this from my laptop from a non-fixed IP and there is no easy way
for me to forward the display (loging e.g. with ssh -X), or to just isolate the
pylab part of the code (lots of files, lots of lines, etc).

I am desperately trying to run this long calculation on that remote machine (and
do it while my laptop is off, using screen) because I need a lot of memory and
CPU How can I overpass this easily (just allowing for the code not to crash
with that initialisation and go on with the rest) ???

thanks for any input there

Eric

running: matplotlib version 0.98.3 Python 2.5.1 (r251:54863, Aug  1 2008,
00:35:20) via IPython 0.9.1

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] pylab or not... crashes or not

2008-12-02 Thread Eric Emsellem
I am indeed using ipython 0.8.1. Will try to upgrade and see how it goes.
Indeed this looks like the deadlocks people mentioned, within, as Xavier
emphasised, no way to CTRL-C it to kill it.

thanks for the tips
Eric

Yannick Copin wrote:
 Salut Eric,
 
 Date: Mon, 01 Dec 2008 20:08:00 +0100
 From: Eric Emsellem [EMAIL PROTECTED]
 Subject: [Matplotlib-users] pylab or not... crashes or not

 - when I start a session with ipython -pylab I often get crashes
 with my
 session. When I mean often, it means really often like once
 everything 1/2h or
 so. A crash means that the command I just sent gets stuck and the only
 way for
 me to get it back is to kill the PID of the ipython process...
 [...]
 IPython 0.8.1 -- An enhanced Interactive Python.
 
 I would say the pb is actually coming from ipython. I experienced it
 while using ipython-0.8.1, but I guess it disappeared starting with
 ipython-0.8.3 (see http://ipython.scipy.org/moin/WhatsNew083:
 Multithreaded shells (used e.g. by matplotlib interaction) have been
 improved, reducing the possibility of corner case deadlocks.). I'm now
 using 0.8.4 and I don't remember I ever had this pb again.
 
 See you! (and congrats ;-) )

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


Re: [Matplotlib-users] pylab or not... crashes or not

2008-12-02 Thread Eric Emsellem
running the last ipython version now (0.9.1), and it does not help (got stuck
the same way).

The difference now is that ipython provides a message:

Warning: Timeout for mainloop thread exceeded
switching to nonthreaded mode (until mainloop wakes up again)

It seems that ipython developers did catch the issue and made this message to be
delivered so that at least you can go on working with your session. However, I
cannot do anything with matplotlib after that message is given, and I have to
get out of the session and start again if I want to plot something...

This seems therefore linked to matplotlib and not ipython.. Just that now
ipython does not get stuck anymore but provide a message regarding the thread
issue. (Not very useful in this context for me unfortunately)

See the ipython scipy thread in fact :
http://lists.ipython.scipy.org/pipermail/ipython-user/2008-July/005628.html

So as far as I can tell this is a matplotlib bug and noone so far encountering
this problem has a really good idea why it occurs. Indeed the problem occurs
*only* when I launch matplotlib commands (after some time in my ipython 
session).

Really annoying but as mentioned before, I cannot get a set of commands which
consistenly break the session, so...

Eric

Yannick Copin wrote:

 I would say the pb is actually coming from ipython. I experienced it
 while using ipython-0.8.1, but I guess it disappeared starting with
 ipython-0.8.3 (see http://ipython.scipy.org/moin/WhatsNew083:
 Multithreaded shells (used e.g. by matplotlib interaction) have been
 improved, reducing the possibility of corner case deadlocks.). I'm now
 using 0.8.4 and I don't remember I ever had this pb again.

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


[Matplotlib-users] pylab or not... crashes or not

2008-12-01 Thread Eric Emsellem
Hi

this may be a known problem (didn't find anything on this issue) but here it is:

- when I start a session with ipython -pylab I often get crashes with my
session. When I mean often, it means really often like once everything 1/2h or
so. A crash means that the command I just sent gets stuck and the only way for
me to get it back is to kill the PID of the ipython process...

The problem is that it is almost impossible to reproduce a systematic behaviour
there so I cannot really send you a list of commands which results in a crash.
It just happens (often). However, after someone suggested it, I now enter
Ipython by a simple ipython and do immediately from pylab import *. And then
I have NO crashes whatsoever.

any suggestion there? Is that normal?

thanks
Eric

P.S.: OpenSuse 11.0 or 10.3 (two machines showing similar behaviour)
matplotlib version 0.98.3

verbose.level helpful

interactive is True

units is True

platform is linux2

backend GTKAgg version 2.10.6

Python 2.5.1 (r251:54863, Aug  1 2008, 00:35:20)
IPython 0.8.1 -- An enhanced Interactive Python.

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


Re: [Matplotlib-users] Plotting issue with mpl = getting stuck

2008-05-13 Thread Eric Emsellem
Hi,
thanks for the input.

In fact this happens on a dual core machine. As for the Ipython version etc it
is written at the end of my original email.

I'll try to see with the Ipython forum maybe. Not sure where it comes from,
which is the difficult part (mpl, ipython, or...?)

I'll also try to isolate some simple functions which does this... But this may
be hard to do.

thanks

Eric

-
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] set_extent for contours?

2007-08-27 Thread Eric Emsellem
Hi,

is there a plan (or an existing command) to have set_extent working for
contours, as was recently done for imshow? I know that contour has
different inputs since you can specify X,Y, the data coordinates.
However, I would like to do something like:

...
co = contour(data, extent=(0.,2.,0.,2.))
...
co.set_extent((-1.,1.,-1.,1.))
...

without being forced to redraw everything.

Any suggestion?

thanks!

Eric

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] stuck after a mpl_connect - how to disconnect and go on

2007-08-23 Thread Eric Emsellem
Hi

thanks a lot for this feedback!

Your example is quite nice indeed. However there is something I may not
have fully understand.
If I use the example you sketch, I of course need to call the displayer
class (right?), by doing something like:

test = displayer()

However, then I hit the same problem again: I would need to define ALL
the commands I wish to go through WITHIN the displayer class (and more
precisely into the show_next function), because any command put after
the test = displayer() would be executed anyway without waiting that I
finally hit the right mouse button.

Or is there something I didn't catch which would allow me to go around this?

(what my program is supposed to do at the end is to go through a series
of (3xdataframes), and for each dataframe in turn, use the offset
trick, then reinitialise everything and start with the next series...
This seems to imply that I need to specify the full set of commands
within the displayer class show_next function)

thanks again

Eric

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] stuck after a mpl_connect - how to disconnect and go on

2007-08-22 Thread Eric Emsellem
Hi

sorry to post this again but all my attempts to solve the matplotlib
problem below failed and I desperately need this to progress.

I would like to use mpl_connect and disconnect to examine a series of 2d
arrays in turn (with a for loop), one after the other:

== at each iteration I'd like to be able to use the left mouse button
to evaluate the sum of all x,y coordinates I select by (right) clicking
somewhere in the present array, and then switch to the next 2d data
array after I hit the right mouse button (button==3). I have no clue how
to do this and the program I wrote so far is just hanging there and does
nothing. Didn't see anything like this in the archive.

Any way to get out of this? Thanks for your help.

Eric

#=
# stupid simple code just to illustrate the kind of things I would like to 
achieve
# This does not work and just hang there...
#=
import numpy as num

class offset:
   def __init__(self) :
  self.xc = 0.
  self.yc = 0.
  self.stay = 1
   def on_click(self, event) :
  if event.button == 1:
 if event.inaxes is not None:
self.xc += event.xdata
self.yc += event.ydata
  elif event.button == 3:
 self.stay = 0

data1 = num.random.rand(10,10)
data2 = num.random.rand(10,10)
data3 = num.random.rand(10,10)
alldata = [data1, data2, data3]
for i in range(len(alldata)) :
   imshow(alldata[i])
   newoffset = offset()
   binding = connect('button_press_event', newoffset.on_click)
   while newoffset.stay :
  pass

   disconnect(binding)
   print newoffset.xc, newoffset.yc


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Gnome problem when plotting with mpl

2007-04-10 Thread Eric Emsellem
Hi,

a problem that I have since some time now using mpl: everytime I start
plotting, I get something like:

(python:6374): GnomePrintCupsPlugin-WARNING **: iconv does not support
ppd character encoding: ISOLatin1, trying CSISOLatin1

I know this is not really a mpl problem, but if anybody has a clue, it
is welcome!

cheers
Eric

matplotlib version 0.87.7
verbose.level helpful
interactive is False
platform is linux2
numerix numpy 1.0.2.dev3534
font search path
['/usr/local/lib/python2.4/site-packages/matplotlib/mpl-data']
backend WXAgg version 2.6.2.1
Python 2.4.2 (#1, May  2 2006, 08:13:46)


on Suse 10.1.

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] where is twiny ??

2007-02-13 Thread Eric Emsellem
Hi,

I would need the equivalent of twinx, but for other axis, so a twiny
function. Shouldn't it be in mpl already?

thanks for your help,

Eric

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] x=, y=, z=??

2007-01-12 Thread Eric Emsellem
Dear all,

I am coming back to an issue for which I didn't get a direct answer
(except for a very nice module from Angus McMorland!):

- at the moment different backends in mpl automatically provides, when
an image (or a plot) is displayed with e.g. imshow (plot), the
coordinates x and y directly in the toolbar.

- When it is indeed an image wich is displayed, it would, in my opinion
makes a LOT of sense to also display the z coordinate, namely the
'intensity' value of the pixel of the image on which the cursor is
standing.

The questions are then: does this also make sense to you, and if yes,
would it be possible for someone to implement it as an intrinsic feature
of mpl backends?  (I am not competent to answer the feasibility part
here, although the module Angus nicely provided on the list is an
excellent example, even if it adds one more layer which may be avoidable).

thanks for any input here!
cheers

Eric

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] a memory + CPU problem when using mpl_connect?

2006-12-29 Thread Eric Emsellem
Hi,

thanks for this useful and quick answer. I am (always) using GTKAgg
(hope it is a good choice). I understand the 40 Mb part then, but not
the 150-200 Mb... (this happens when I move the cursor within the figure
window only and things get worse when I reload the data with a new imshow).

Two things from what you say:

* first : should I do something before redoing another imshow? (when I
cycle many times through the 3 commands, connect, disconnect, imshow,
the mouse event updating gets really slow, and in fact it seems only the
imshow really makes things worse..). Maybe I need to flush the old
data/image/imshow ?

* second: I tried to understand what you mentioned in your email about
the blit thing. I understand the principle, reading the wiki, and
going into mpl examples, but I didnt manage to implement it in practice
(see my pathetic attempt below). I guess the main reason is that I am
not sure what should be the background in the case of a figtext...
(not ax.bbox I guess but then what?)

Any help is welcome (or a hint, since doing it myself is I guess the
best way to learn ...)

thanks again
Eric

#===
# This script is not working... something I didn't understand in
blitting
#===
import numpy as num
import matplotlib as mpl 
import matplotlib.pylab as plab

data = num.random.rand(200,200)
xy = [num.arange(0.,20,.1), num.arange(0.,20,.1)]

fig = plab.figure()
canvas = fig.canvas
im = plab.imshow(data, extent=[0.,20.,0.,20.])
ftext = plab.figtext(0.9,0.9,, animated=True)
ax = plab.gca()
background = canvas.copy_from_bbox(ax.bbox)

def whichpix_inframe(coord) :
   indw = num.zeros(2, num.int32)
   if len(coord) == 2 :
  indw[0] = num.sort(xy[0]).searchsorted(coord[0])
  indw[1] = num.sort(xy[1]).searchsorted(coord[1])
   return indw

def mouse_move(event) :
   if event.inaxes :
 canvas.restore_region(background)
 ftext.set_text(str(data[tuple(whichpix_inframe([event.xdata,
event.ydata]))]))
 ax.draw_artist(ftext)
 canvas.blit(ax.bbox)
# canvas.draw()

id = canvas.mpl_connect('motion_notify_event', mouse_move)

canvas.mpl_disconnect(id)

John Hunter wrote:
 Eric 2/ When I now use the mouse_move event, it can go up to 150
 Eric Mb of memory usage!! Again: is that normal?

 In your example code below, I notice you are drawing on every mouse
 motion.  I believe there is a Tkinter specific leak in TkAgg if memory
 serves, but it's outside of mpl.  What backend are you using?  Does
 the problem go away with a different backend?
...
 The basic idea is to capture the background as a pixel buffer,
 identify the rectangle region you want to draw the text into, draw the
 background, update the text, redraw only the text rectangle etc
 See 

   http://www.scipy.org/Cookbook/Matplotlib/Animation

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] (default) tracing intensity in imshow, figimage etc

2006-12-29 Thread Eric Emsellem
Hi again,
thinking about the module I am writing which will include a move mouse
event to get the intensity of the pixel in an imshow provided in the
figure I am wondering:

- would it make any sense to DIRECTLY include such a facility (intensity
of pixel provided for an imshow, figimage...) NEXT to the coordinates x
 Y which are already there (in the lower right) in mpl figures 

To me (at least) it would make a LOT of sense, since x,y are already
provided for any plot, or imshow-like commands. The third axis
(intensity) would then only appear when there is a third dimension is
available of course (imshow, etc). I can imagine that such a facility
could be turned on or off (I guess...).

no?

Eric

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] a memory + CPU problem when using mpl_connect?

2006-12-29 Thread Eric Emsellem
great! but one question though: I need to put the text with figtext and
thus use figure coordinates (instead of pixel coord).
So how would I replace the :

matplotlib.transforms.lbwh_to_bbox

?

thanks

Eric
John Hunter wrote
 def ondraw(event):
 l,b,w,h = t.get_window_extent(event.renderer).get_bounds()

 figw, figh = fig.figwidth.get(), fig.figheight.get()
 # expand the rectangle to account for larger text; coords are pixel space
 ondraw.bbox = matplotlib.transforms.lbwh_to_bbox(
 l-10, b-10, w+200, h+20)
 ondraw.background = fig.canvas.copy_from_bbox(ondraw.bbox)
 ondraw.background = None
 ondraw.bbox = None
   

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] a memory + CPU problem when using mpl_connect?

2006-12-29 Thread Eric Emsellem




sorry for all this. I guess I don't fully understand the bbox thing

Anyway it works great except for 2 things:
** now the x,y coordinates in the toolbar are VERY SLOWLY updated... In
fact as the mouse moves, the coordinates do not show up and are only
updated when it is stopped.
** my text does not appear fully (some part is blanked, and changing
the bbox does not seem to do much)

Eric

John Hunter wrote:

  

  

  
"Eric" == Eric Emsellem [EMAIL PROTECTED] writes:

  

  

  
  
Eric great! but one question though: I need to put the text with
Eric figtext and thus use figure coordinates (instead of pixel
Eric coord).  So how would I replace the :

Eric matplotlib.transforms.lbwh_to_bbox

It shouldn't matter which way you create the text instance.

JDH

  


-- 
====
Eric Emsellem [EMAIL PROTECTED]
   Centre de Recherche Astrophysique de Lyon
9 av. Charles-Andretel: +33 (0)4 78 86 83 84
69561 Saint-Genis Laval Cedex  fax: +33 (0)4 78 86 83 86
Francehttp://www-obs.univ-lyon1.fr/eric.emsellem





-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] \n not working in text ?

2006-12-28 Thread Eric Emsellem
hi,

I am trying to have text written on 2 lines, but everything is written
on a single line. Is that normal?

here is an example:

plot(arange(10))
ylabel('this is vertical \n test')
text(0.5,0.5,this is a test \n but does not work)

thanks
Eric
===
Suse 10.1
matplotlib version 0.87.7
numerix numpy 1.0.2.dev3491
Python 2.4.2 (#1, May  2 2006, 08:13:46)
IPython 0.7.4.svn.r2010 -- An enhanced Interactive Python.


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] \n not working in text ?

2006-12-28 Thread Eric Emsellem
ok thanks for the check. Since it seems like a personal setting pb, I
have now restarted from a clean matplotlibrc and set up my prefered option.
It now works (no clue why it didn't...)

sorry for the trouble and thanks for doing that test.
cheers
Eric

Eric Firing wrote:
 It works on my machine (linux) with svn, but I don't see anything
 about this in CHANGELOG.

 Eric

 Eric Emsellem wrote:
 hi,

 I am trying to have text written on 2 lines, but everything is written
 on a single line. Is that normal?

 here is an example:

 plot(arange(10))
 ylabel('this is vertical \n test')
 text(0.5,0.5,this is a test \n but does not work)

 thanks
 Eric
 ===
 Suse 10.1
 matplotlib version 0.87.7
 numerix numpy 1.0.2.dev3491
 Python 2.4.2 (#1, May  2 2006, 08:13:46)
 IPython 0.7.4.svn.r2010 -- An enhanced Interactive Python.



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Transparency disappears when saving a figure in Postscript

2006-11-06 Thread Eric Emsellem
Hi,

below is a simple script illustration what I wish to do:
== use new symbols (here ellipses for example) and plot a number of
points with 'scatter', allowing transparency (alpha=0.2) to see when two
data points overlap.
For some reason this works: 1/ on the figure 2/ when saving as .png
but it does NOT work when saving as a Postscript file.

Is there an easy solution for this? (I am using GTKAgg, mpl 0.87.5)

(doing a convert afterwards works but this is not very practical here)

thanks in advance

Eric
P.S.: for the example above, just using standard circles would have the
same effect
#===
import numpy as num

rx, ry = 1.8, 1.
area = rx * ry * num.pi
theta = num.arange(0, 2*num.pi+0.01, 0.1)
verts = zip(rx/area*num.cos(theta), ry/area*num.sin(theta))

clf()
x = [0,0.1,0.2, 0.5]
y = [0.,0.1,0.,0.2]
scatter(x,y, c='0.8', edgecolor='k', faceted=True, s=300, marker=None,
verts=verts, alpha=0.2)
## saving as a png
savefig('tmp.png')
## the figure shows the transparency well

## now saving as a postscript
savefig('tmp.ps')
## == the symbols overlap but the transparency is gone


-- 

Eric Emsellem [EMAIL PROTECTED]
   Centre de Recherche Astrophysique de Lyon
9 av. Charles-Andretel: +33 (0)4 78 86 83 84
69561 Saint-Genis Laval Cedex  fax: +33 (0)4 78 86 83 86
Francehttp://www-obs.univ-lyon1.fr/eric.emsellem



-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] crashes when using savefig for eps files

2006-10-17 Thread Eric Emsellem




Hi,

I have a problem saving eps files in certain conditions. Unfortunately I
am unable to find a simple example which may be very illustrative here
to show you when it works and when it does not.
I include the error message below and so the question is: does anybody
have a hint of why the savefig fails and crashes?

(I tried to close('all'), rcdefaults, etc).

thanks for any input,

Eric
=

 savefig('toto.eps')


Your figure is too big to fit on a4 paper. b4 paper will be used to
prevent clipping.
AFPL Ghostscript 8.51: Unrecoverable error, exit code 1
---
exceptions.NameError Traceback (most
recent call last)

/home/science/Sauron/AnalysisKin/Paper7/ipython console

/usr/local/lib/python2.4/site-packages/matplotlib/pylab.py in
savefig(*args, **kwargs)
809 def savefig(*args, **kwargs):
810 fig = gcf()
-- 811 return fig.savefig(*args, **kwargs)
812 if Figure.savefig.__doc__ is not None:
813 savefig.__doc__ = _shift_string(Figure.savefig.__doc__)

/usr/local/lib/python2.4/site-packages/matplotlib/figure.py in
savefig(self, *args, **kwargs)
673 kwargs[key] = rcParams['savefig.%s'%key]
674
-- 675 self.canvas.print_figure(*args, **kwargs)
676
677 def colorbar(self, mappable, cax=None, **kw):

/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py
in print_figure(self, filename, dpi, facecolor, edgecolor, orientation,
**kwargs)
112 try:
113 agg.print_figure(filename, dpi, facecolor,
edgecolor,
-- 114  orientation, **kwargs)
115 except IOError, msg:
116 error_msg_gtk('Failed to save\nError message:
%s'%(msg,), self)

/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py
in print_figure(self, filename, dpi, facecolor, edgecolor, orientation,
**kwargs)
486 ps = self.switch_backends(FigureCanvasPS)
487 ps.print_figure(filename, dpi, facecolor, edgecolor,
-- 488 orientation, **kwargs)
489 elif ext.find('pdf')=0:
490 from backend_pdf import FigureCanvasPdf

/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_ps.py
in print_figure(self, outfile, dpi, facecolor, edgecolor, orientation,
papertype)
999 # Let's keep the usetex stuff seperate from the
generic postscript
   1000 self._print_figure_tex(outfile, dpi, facecolor,
edgecolor,
- 1001orientation, papertype)
   1002 else:
   1003 if  isinstance(outfile, file):

/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_ps.py
in _print_figure_tex(self, outfile, dpi, facecolor, edgecolor,
orientation, papertype)
   1233 elif rcParams['text.usetex']:
   1234 if False: pass # for debugging
- 1235 else: gs_distill(tmpfile, ext=='.eps',
ptype=papertype, bbox=bbox)
   1236
   1237 if  isinstance(outfile, file):

/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_ps.py
in gs_distill(tmpfile, eps, ptype, bbox)
   1331 exit_status = os.system(command)
   1332 fh = file(outfile)
- 1333 if exit_status: raise RuntimeError('ghostscript was not able
to process \
   1334 your image.\nHere is the full report generated by ghostscript: \
   1335 \n\n'% dvifile + fh.read())

NameError: global name 'dvifile' is not defined


-- 

Eric Emsellem [EMAIL PROTECTED]
   Centre de Recherche Astrophysique de Lyon
9 av. Charles-Andretel: +33 (0)4 78 86 83 84
69561 Saint-Genis Laval Cedex  fax: +33 (0)4 78 86 83 86
Francehttp://www-obs.univ-lyon1.fr/eric.emsellem





-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] bug importing numpy with matplotlib.numerix

2006-10-10 Thread Eric Emsellem
Hi,

I have a problem when importing numpy from matplotlib.numerix:

 When I do:

import matplotlib
import matplotlib.numerix as num # numpy
from num import median, std

  I get:
exceptions.ImportError   Traceback (most
recent call last)
ImportError: No module named num

It seems that it does not import numpy but something else. (for example
num.std does not exist).
How do I solve that? (I saw a thread which seems to indicate that it was
solved recently, but I have recent versions of everything :
matplotlib version 0.87.5
platform is linux2
numerix numpy 1.0rc1.dev3157
backend GTKAgg version 2.8.2
Python 2.4.2 (#1, May  2 2006, 08:13:46)
IPython 0.7.3.svn -- An enhanced Interactive Python.

What could I do there?

Note that in the help of matplotlib.numerix, numpy is only indicated in
Option 0. (see below)

thanks for any help there.

Eric
==
when I do:

help num

== I get:

Help on package matplotlib.numerix in matplotlib:

NAME
matplotlib.numerix - numerix  imports either Numeric or numarray
based on various selectors.

FILE
/usr/local/lib/python2.4/site/packages/matplotlib/numerix/__init__.py

DESCRIPTION
0.  If the value --numpy,--numarray or --Numeric is specified
on the
command line, then numerix imports the specified
array package.

1. The value of numerix in matplotlibrc: either Numeric or numarray

2. If none of the above is done, the default array package is Numeric.
   Because the matplotlibrc always provides *some* value for numerix
   (it has it's own system of default values), this default is most
   likely never used.

To summarize: the  commandline is examined first, the  rc file second,
and the default array package is Numeric.


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] bug in saving figure with dashed lines

2006-08-01 Thread Eric Emsellem
Hi,
I just produced a plot with a curve dashed line:

when saving it into a png file it works fine.
But when saving it in a postscript the dashed line looks solid on most
of the plot.
This happens if there are too many points in the line:

x = arange(0,1.,0.0001)
y = sqrt(x)
plot(x,y,'k--')
## Png file is ok
savefig(toto.png)
## Eps file is NOT ok
savefig(toto.eps)

Any cure to that behaviour?

Thanks!!!
Eric

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users