Re: [Matplotlib-users] Color Map.

2009-01-15 Thread Scott Sinclair
> 2009/1/15  :
>>Matplotlib is a purely 2D plotting library, it doesn't provide similar
>>capability to the Matlab 'mesh' function. For 3D plotting you could
>>use Mayavi
>
>
> Do you have some example of Python programs using Mayavi ? Simple
> examples would be good ones.

Please make sure to direct your response to the mailing list so that
others can offer assistance, on this list that means using
"Reply-to-all".

Unfortunately, I don't use Mayavi and therefore don't have any easy
examples to offer. I guess you might find such things in the user
guide or Cookbook.

http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/
http://www.scipy.org/Cookbook/MayaVi

Cheers,
Scott

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plot() cuts off long tick labels

2009-01-15 Thread Eric Firing
Chris Fonnesbeck wrote:
> Is there any way of preventing tick label names from being cut off by
> the plot canvas? Seems to happen every time:
> 
> http://a3.s3.p.quickshareit.com/files/validationb0e66.png
> 
> Thanks in advance.
> 

There is no automatic way.  If you are going to use long labels like 
that, then you need to use subplots_adjust or other manual methods for 
positioning your axes within your figure.

Eric

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plot() cuts off long tick labels

2009-01-15 Thread Chris Fonnesbeck
Is there any way of preventing tick label names from being cut off by
the plot canvas? Seems to happen every time:

http://a3.s3.p.quickshareit.com/files/validationb0e66.png

Thanks in advance.

-- 
Chris Fonnesbeck
Department of Mathematics and Statistics
PO Box 56, University of Otago
Dunedin, New Zealand

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plot() cuts off long tick labels

2009-01-15 Thread Chris Fonnesbeck
Is there any way of preventing tick label names from being cut off by
the plot canvas? Seems to happen every time:

http://a3.s3.p.quickshareit.com/files/validationb0e66.png

Thanks in advance.

-- 
Chris Fonnesbeck
Department of Mathematics and Statistics
PO Box 56, University of Otago
Dunedin, New Zealand

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Vertical alignment of a text

2009-01-15 Thread Jae-Joon Lee
I presume that you're only interested in the math formula, and not in
any other graphical functionality of MPL. You may use mathtext module
directly in that case.

from matplotlib.mathtext  import MathTextParser

p = MathTextParser("bitmap")
filename, texstr = "test.png", r"$\alpha$"
p.to_png(filename, texstr)
d = p.get_depth(texstr)

Take a look at the documentation for more details.

-JJ


On Thu, Jan 15, 2009 at 3:54 PM,   wrote:
> Indeed I would also use mpl to have png of formulas so as to put them in a
> HTML page.
>
> C.
>
>
>>va="baseline" does not work?
>>
>>-JJ
>>
>>
>>On Thu, Jan 15, 2009 at 3:05 AM,   wrote:
Dimension of a text in mpl is renderer-dependent in general.
Each renderer has "get_text_width_height_descent" method which
> returns
width, height, and descent of the given text.
If you're only interested in latex-rendered text, you may use the
get_text_width_height_descent() method in the TexManager.

As you see, it is possible to know the dimension of the text, but
these functionalities are not exposed to the user, and a bit difficult
 to use unless you're familiar with mpl. If you let us know for what
you need to use the depth of the text, we may come up with some
> simple
solution.

Regards,

-JJ
>
>

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] error compiling MPL: "gtktools.py: no such file or directory"

2009-01-15 Thread Hani Nakhoul
The clean build and install worked! (I'm sorry I couldn't get it to work
before--I must not have cleaned it properly.) It's running without any
problems. Thank you very much!

Hani

On Thu, Jan 15, 2009 at 1:09 PM, John Hunter  wrote:

> On Mon, Jan 12, 2009 at 9:35 AM, Hani Nakhoul  wrote:
> > I did use sudo--here are the shell command and the install output:
> >
> > sudo python setup.py install
>
> Please try doing a clean build and install following the instructions at
>
>  http://matplotlib.sourceforge.net/faq/installing_faq.html#source-install
>
> Basically do the following
>
>  > sudo rm -rf build
>  > sudo rm -rf /usr/lib/python2.5/site-packages/mpl_toolkits
> /usr/lib/python2.5/site-packages/matplotlib*
>  > python setup.py build > build.out
>  > sudo python setup.py install > install.out
>
> and attach both build.out and install.out in your followup email.
>
> Good luck!
> JDH
>
--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Vertical alignment of a text

2009-01-15 Thread projetmbc
Indeed I would also use mpl to have png of formulas so as to put them in a 
HTML page.

C.


>va="baseline" does not work?
>
>-JJ
>
>
>On Thu, Jan 15, 2009 at 3:05 AM,   wrote:
>>>Dimension of a text in mpl is renderer-dependent in general.
>>>Each renderer has "get_text_width_height_descent" method which 
returns
>>>width, height, and descent of the given text.
>>>If you're only interested in latex-rendered text, you may use the
>>>get_text_width_height_descent() method in the TexManager.
>>>
>>>As you see, it is possible to know the dimension of the text, but
>>>these functionalities are not exposed to the user, and a bit difficult
>>> to use unless you're familiar with mpl. If you let us know for what
>>>you need to use the depth of the text, we may come up with some 
simple
>>>solution.
>>>
>>>Regards,
>>>
>>>-JJ


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib and PyQt

2009-01-15 Thread projetmbc
Message d'origine
>Date: Thu, 15 Jan 2009 13:05:21 -0600
>Sujet: Re: [Matplotlib-users] matplotlib and PyQt
>De: John Hunter 
>A: projet...@club-internet.fr, Paul Ivanov 
>Copie à: matplotlib-users@lists.sourceforge.net
>
>On Wed, Jan 14, 2009 at 11:28 AM, John Hunter  
wrote:
>
>> Paul Ivanov recently wrote pong using the matplotlib event system, and
>> then provided a gtk and qt version of them that requires no additional
>> gui programming save for starting up the window and event loop.
>
>Oops, accidentally attached the gtk version twice and not the qt
>version -- here are the relevant files
>
>
 Thanks. I will look how to adapt this PyQT3 example to PyQt4 
(which are realy differents).

Regards.
Christophe.


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Figure with pyQt

2009-01-15 Thread projetmbc
>> Hello,
>> I would like to see the following example
>> 
http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_demo.
ht
>> 
mlusing the 2nd one
>> 
http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_
qt
>> 
4.html.
>> In fact, I don't undrestand how to add the figure to the screen (I'm a 
real
>> beginner with matplotlib but not with PyQt).
>>
>> Thanks for any kind of help.
>>
>
>Everything you need is in those two examples. You create a figure, then
>create a canvas by passing the figure to the FigureCanvasQTAgg()
>constructor. Create the axes using the figure methods, add the ellipses
>using the axes methods, and then you can either set the 
FigureCanvasQTAgg
>instance as the central widget or you can add the canvas to the layout of
>another widget and set the widget as the central widget.
>
>Darren
>
>>> Thanks a lot.

Now I would like to redraw the static graph of the first example. This would 
be my last question.

Regards.
Christophe.

PS : if you want I can give the final example to add it to your examples.


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] scale the legend

2009-01-15 Thread David Geller

Well, that is something I *did not* try! But it works!

Thanks!

D.

Jae-Joon Lee wrote:

If you use recent version of mpl, the size of the overall legend
should scale with the font size.
See below,

import matplotlib.font_manager
prop = matplotlib.font_manager.FontProperties(size=5)
lagend(prop=prop)

Just in case, my preference in your case is to move the legend outside
of the axes area.
Regards,

-JJ



On Wed, Jan 14, 2009 at 9:56 AM, David Geller  wrote:
  

Is it possible to make the relative size of the legend smaller? On my
plots, the legend covers half the plot, and nothing I have tried so far
seems to shrink the legend.

Thanks!

David

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users




  


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Figure with pyQt

2009-01-15 Thread Darren Dale
On Thu, Jan 15, 2009 at 11:56 AM,  wrote:

> Hello,
> I would like to see the following example
> http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_demo.ht
> mlusing
>  the 2nd one
> http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt
> 4.html.
> In fact, I don't undrestand how to add the figure to the screen (I'm a real
> beginner with matplotlib but not with PyQt).
>
> Thanks for any kind of help.
>

Everything you need is in those two examples. You create a figure, then
create a canvas by passing the figure to the FigureCanvasQTAgg()
constructor. Create the axes using the figure methods, add the ellipses
using the axes methods, and then you can either set the FigureCanvasQTAgg
instance as the central widget or you can add the canvas to the layout of
another widget and set the widget as the central widget.

Darren
--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib and PyQt

2009-01-15 Thread projetmbc
Title: Flashmail




>Simson Garfinkel wrote: >> Why do you want to use PyQt and not wxwidgets? >> >maybe because the Qt license changed ? >That's a reason for me to be interested in the answer. > >cheers, >Stef 
 
Here something that could interest you.
Christophe
 
 
 
Dear Qt User: Nokia is pleased to announce that with the release of Qt 4.5 you will be able to use Qt under the Lesser General Public License (LGPL) version 2.1 terms. When released in March 2009, Qt will be made available under three licensing options: Commercial, LGPL and GPL. Prior versions of Qt are not impacted by this announcement. Nokia is committed to Qt and its continued development. By offering Qt under LGPL version 2.1 license terms alongside today’s
licensing options Nokia hopes to: - facilitate wider adoption of Qt across industries, desktop, web and embedded platforms. - establish Qt as a de facto standard for application development. - receive more valuable feedback and increased user contributions to ensure that Qt remains the best-in-class, cross-platform framework. - extend Nokia’s existing platform commitment to the open source community. By offering a cost-free LGPL license as well as commercial and
GPL licenses to Qt, you can choose the license model that best fits your development requirements. Irrespective of which license model you choose: - Qt Software is committed to continuing to provide our customers with the same level of professional support, services and regular releases you have come to expect of Qt Software. - We will continue to actively develop Qt, and with a greater degree of cooperation with the community through a new contribution model, we
hope to make Qt even more valuable to our users. For more information on the introduction of the LGPL license and what this means for you, please consult the Frequently Asked Questions section on www.qtsoftware.com. Best regards Tom Miller Director of Sales Nokia, Qt Software  


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib and PyQt

2009-01-15 Thread Stef Mientki
Simson Garfinkel wrote:
> Why do you want to use  PyQt and not wxwidgets?
>   
maybe because the Qt license changed ?
That's a reason for me to be interested in the answer.

cheers,
Stef

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] error compiling MPL: "gtktools.py: no such file or directory"

2009-01-15 Thread John Hunter
On Mon, Jan 12, 2009 at 9:35 AM, Hani Nakhoul  wrote:
> I did use sudo--here are the shell command and the install output:
>
> sudo python setup.py install

Please try doing a clean build and install following the instructions at

  http://matplotlib.sourceforge.net/faq/installing_faq.html#source-install

Basically do the following

  > sudo rm -rf build
  > sudo rm -rf /usr/lib/python2.5/site-packages/mpl_toolkits
/usr/lib/python2.5/site-packages/matplotlib*
  > python setup.py build > build.out
  > sudo python setup.py install > install.out

and attach both build.out and install.out in your followup email.

Good luck!
JDH

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib and PyQt

2009-01-15 Thread John Hunter
On Wed, Jan 14, 2009 at 11:28 AM, John Hunter  wrote:

> Paul Ivanov recently wrote pong using the matplotlib event system, and
> then provided a gtk and qt version of them that requires no additional
> gui programming save for starting up the window and event loop.

Oops, accidentally attached the gtk version twice and not the qt
version -- here are the relevant files
#!/usr/bin/env python
# A matplotlib based game of Pong illustrating one way to write interactive
# animation which are easily ported to multiply backends
# pipong.py was written by Paul Ivanov 

import numpy as np
import matplotlib.pyplot as plt
from numpy.random import randn, randint

instructions = """
Player A:   Player B:
  'e'  up 'i'
  'd' down'k'

press 't' -- close these instructions 
(animation will be much faster)
press 'a' -- add a puck
press 'A' -- remove a puck 
press '1' -- slow down all pucks   
press '2' -- speed up all pucks
press '3' -- slow down distractors 
press '4' -- speed up distractors  
press ' ' -- reset the first puck
press 'n' -- toggle distractors on/off
press 'g' -- toggle the game on/off

  """

class Pad(object):
def __init__(self, disp,x,y,type='l'):
self.disp = disp
self.x = x
self.y = y
self.w = .3
self.score = 0
self.xoffset = 0.3
self.yoffset = 0.1
if type=='r':
self.xoffset *= -1.0

if type=='l' or type=='r':
self.signx = -1.0
self.signy = 1.0
else:
self.signx = 1.0
self.signy = -1.0
def contains(self, loc):
return self.disp.get_bbox().contains(loc.x,loc.y)

class Puck(object):
def __init__(self, disp, pad, field):
self.vmax= .2
self.disp = disp
self.field = field
self._reset(pad)
def _reset(self,pad):
self.x = pad.x + pad.xoffset
if pad.y < 0:
self.y = pad.y +  pad.yoffset 
else:
self.y = pad.y - pad.yoffset
self.vx = pad.x - self.x
self.vy = pad.y + pad.w/2 - self.y
self._speedlimit()
self._slower()
self._slower()
def update(self,pads):
self.x += self.vx
self.y += self.vy
for pad in pads:
if pad.contains(self):
self.vx *= 1.2 *pad.signx
self.vy *= 1.2 *pad.signy
fudge = .001
#probably cleaner with something like...if not self.field.contains(self.x, self.y):
if self.x < 0+fudge:
#print "player A loses"
pads[1].score += 1;
self._reset(pads[0])
return True
if self.x > 7-fudge:
#print "player B loses"
pads[0].score += 1;
self._reset(pads[1])
return True
if self.y < -1+fudge or self.y > 1-fudge:
self.vy *= -1.0 
# add some randomness, just to make it interesting
self.vy -= (randn()/300.0 + 1/300.0) * np.sign(self.vy)
self._speedlimit()
return False
def _slower(self):
self.vx /= 5.0
self.vy /= 5.0
def _faster(self):
self.vx *= 5.0
self.vy *= 5.0
def _speedlimit(self):
if self.vx > self.vmax:
self.vx = self.vmax
if self.vx < -self.vmax:
self.vx = -self.vmax

if self.vy > self.vmax:
self.vy = self.vmax
if self.vy < -self.vmax:
self.vy = -self.vmax

class Game(object):

def __init__(self, ax):
# create the initial line
self.ax = ax
padAx = padBx= .50
padAy = padBy= .30
padBx+=6.3
pA, = self.ax.barh(padAy,.2, height=.3,color='k', alpha=.5, edgecolor='b',lw=2,label="Player B", animated=True)
pB, = self.ax.barh(padBy,.2, height=.3, left=padBx, color='k',alpha=.5, edgecolor='r',lw=2,label="Player A",animated=True)

# distractors
self.x = np.arange(0,2.22*np.pi,0.01)
self.line, = self.ax.plot(self.x, np.sin(self.x),"r", animated=True, lw=4)
self.line2, = self.ax.plot(self.x, np.cos(self.x),"g", animated=True, lw=4)
self.line3, = self.ax.plot(self.x, np.cos(self.x),"g", animated=True, lw=4)
self.line4, = self.ax.plot(self.x, np.cos(self.x),"r", animated=True, lw=4)
self.centerline,= self.ax.plot([3.5,3.5], [1,-1],'k',alpha=.5, animated=True,  lw=8)
self.puckdisp = self.ax.scatter([1],[1],label='_nolegend_', s=200,c='g',alpha=.9,animated=True)

self.canvas = self.ax.figure.canvas
self.background = None
self.cnt = 0
self.distract = True
self.res = 100.0
self.on = False
self.inst = True# show instructions from the beginning
self.background = None
self.pads = []
self.pads.append( Pad(pA,0,padAy))
self.pads.append( Pad(pB,padBx,padBy,'r

[Matplotlib-users] Scale subplot plots?

2009-01-15 Thread Eric Jonas
I've looked in both the examples and the docs, and have yet to find a
clear way of accomplishing the following: 

I have a plot with two subplots: 

|---|
|   |
|   |
|---|
|   |
|   |
|   |
.   .
.   .


That is, I want the top subplot (which shows aggregate data, using the
same x-axis) to always be, say, 80 pix high, and the bottom subplot
to scale with the number of things (in this case, sparkline-like
timelines) I add to it. So there's not a constant ratio between
the top and bottom subplots. Might anyone be able to point me in the
right direction, either to an explicit example or someplace in the
docs? 


Thanks!
...Eric Jonas




--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Figure with pyQt

2009-01-15 Thread projetmbc
Hello,
I would like to see the following example 
http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_demo.ht
ml using the 2nd one 
http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt
4.html .
In fact, I don't undrestand how to add the figure to the screen (I'm a real 
beginner with matplotlib but not with PyQt).

Thanks for any kind of help.


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Color Map.

2009-01-15 Thread Ryan May
Oscar ¿? wrote:
> Hello folks,
> 
> I´m a new user of this forum. I'm trying to work in Python at the moment
> but it´s quite difficult for me. My first question is if it is possible
> to do Color Maps in Matplotlib in the same manner of the "mesh" function
> in Matlab. Could you help me anybody?

Since you're just starting out, I'd take a look at:

http://matplotlib.sourceforge.net/gallery.html

to get a feel for what's possible with matplotlib.  It sounds like what you're
interested would be pcolor/pcolormesh.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Segmentation fault when calling imshow with complex array

2009-01-15 Thread Michael Droettboom
Thanks for the report.

This issue is actually already fixed in matplotlib SVN as of r6283:

http://matplotlib.svn.sourceforge.net/viewvc/matplotlib?view=rev&revision=6283

You can use the above patch to patch your local copy if you don't want 
to install entirely from SVN.

Mike

Philipp Lies wrote:
> Hi,
>
> I have a problem with pyplot. When I'm passing an numpy array with complex
> entries to imshow I receive the error message:
> TypeError: array cannot be safely cast to required type
> Which is ok, when I thereafter call imshow with a valid image (i)python
> segfaults. Sometimes it even segfaults instead of the above error message:
>
> Python 2.5.2 (r252:60911, Oct 5 2008, 19:29:17)
> [GCC 4.3.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>   
 from matplotlib.pyplot import *
 
> /usr/lib/python2.5/site-packages/pytz/__init__.py:29: UserWarning: Module
> dateutil was already imported from
> /var/lib/python-support/python2.5/dateutil/__init__.py, but
> /var/lib/python-support/python2.5 is being added to sys.path
> from pkg_resources import resource_stream
>   
 from numpy import *
 X = random.uniform(size=(10,10))
 Xc = X*1j
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(X)
 
> 
>   
 imshow(Xc)
 
> Segmentation fault
>
> The only deterministic behaviour after calling imshow with a complex array
> is that it segfaults anytime. Quite annoying because I forget to convert to
> real quite often 8-).
>
> I use matplotlib, python, and numpy with the latest backport version
> available in Ubuntu Intrepid 8.10 amd64 (numpy 1.1.1, python 2.5.2,
> matplotlib
> 0.98.3). Does also crash in ipython 0.9.1 with and without -pylab flag
> started.
>
> I filed a bug but so far no one responded, so maybe here's some help.
> http://sourceforge.net/tracker2/?func=detail&aid=2502029&group_id=80706&atid=560720
>
> Cheers
>
> Phil
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [Matplotlib-announce] Saving image in .jpeg format

2009-01-15 Thread John Hunter
On Thu, Jan 15, 2009 at 7:56 AM, Michael Droettboom  wrote:
> The matplotlib-announce list is for announcements about releases of
> matplotlib and related projects only.  Please ask user questions on
> matplotlib-users.  (I have forwarded this message there).
>
> There is a table of which output formats are supported by each backend here:
>
> http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/FILETYPES?revision=3801&view=markup
>
> GtkAgg should be your best bet, but due to its reliance on Gtk, it can't
> be run on a headless server.  If you need to run in such a mode (such as
> on a webserver), your best bet is probably to use Agg, save to png, and
> use PIL or ImageMagick etc. to convert afterward.

You may want to reevaluate *why* you need jpeg.  We have intentionally
not provided a jpg output because png is so much better for graphs and
text.  If all you are doing is image processing of natural scenes,
then yes jpeg is better in most cases, but if you are making graphs
which is the bread and butter of matplotlib, then png will be
superior.


JDH

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [Matplotlib-announce] Saving image in .jpeg format

2009-01-15 Thread Michael Droettboom
The matplotlib-announce list is for announcements about releases of 
matplotlib and related projects only.  Please ask user questions on 
matplotlib-users.  (I have forwarded this message there).

There is a table of which output formats are supported by each backend here:

http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/FILETYPES?revision=3801&view=markup

GtkAgg should be your best bet, but due to its reliance on Gtk, it can't 
be run on a headless server.  If you need to run in such a mode (such as 
on a webserver), your best bet is probably to use Agg, save to png, and 
use PIL or ImageMagick etc. to convert afterward.

Mike

Emanuele Passera wrote:
> Hi all,
> I have always used .png format for my matplotlib applications but now i am 
> compelled to save many figures in .jpeg format.
> Those image should be automatically saved (no GUI) but i can't find out how 
> to 
> save the images.
>
> Executing this scripts 
>
> import pylab as p
> p.rcParams['backend']='gdk'
> p.figure(1)
> p.plot([1,2,3,4,5,6],[3,7,5,4,6,3])
> p.savefig("example.jpg")
>
> It gives me this error
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 345, in 
> savefig
> return fig.savefig(*args, **kwargs)
>   File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 990, in 
> savefig
> self.canvas.print_figure(*args, **kwargs)
>   File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line 
> 1373, in print_figure
> '%s.' % (format, ', '.join(formats)))
> ValueError: Format "jpg" is not supported.
> Supported formats: emf, eps, pdf, png, ps, raw, rgba, svg, svgz.
>
> Can anyone help me ? (.jpeg extension it doesn't work too)
> By the way, what is the best backend to fulfill the task ? (better quality 
> and 
> less memory leackage ?)
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Color Map.

2009-01-15 Thread Scott Sinclair
> 2009/1/15 Oscar ¿? 
> I´m a new user of this forum. I'm trying to work in Python at the moment but 
> it´s quite difficult for me. My first question is if it is
> possible to do Color Maps in Matplotlib in the same manner of the "mesh" 
> function in Matlab. Could you help me anybody?

Hi Oscar,

Matplotlib is a purely 2D plotting library, it doesn't provide similar
capability to the Matlab 'mesh' function. For 3D plotting you could
use Mayavi

http://code.enthought.com/projects/mayavi/

You can probably still get great visualization of your results using
the Matplotlib functions pcolor, pcolormesh, contour, contourf or
imshow. See the documentation and examples at these links to get
started.

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.pcolor
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.pcolormesh
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.imshow

http://matplotlib.sourceforge.net/examples/pylab_examples/pcolor_demo.html
http://matplotlib.sourceforge.net/examples/pylab_examples/pcolor_demo2.html
http://matplotlib.sourceforge.net/examples/pylab_examples/quadmesh_demo.html
http://matplotlib.sourceforge.net/examples/pylab_examples/contour_image.html

Also look at the pyplot tutorial and post to the list if you get stuck.

http://matplotlib.sourceforge.net/users/pyplot_tutorial.html

Cheers,
Scott

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Saving image in .jpeg format

2009-01-15 Thread Emanuele Passera
Hi all,
I have always used .png format for my matplotlib applications but now i am 
compelled to save many figures in .jpeg format.
Those image should be automatically saved (no GUI) but i can't find out how to 
save the images.

Executing this scripts 

import pylab as p
p.rcParams['backend']='gdk'
p.figure(1)
p.plot([1,2,3,4,5,6],[3,7,5,4,6,3])
p.savefig("example.jpg")

It gives me this error

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 345, in 
savefig
return fig.savefig(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 990, in 
savefig
self.canvas.print_figure(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line 
1373, in print_figure
'%s.' % (format, ', '.join(formats)))
ValueError: Format "jpg" is not supported.
Supported formats: emf, eps, pdf, png, ps, raw, rgba, svg, svgz.

Can anyone help me ? (.jpeg extension it doesn't work too)
By the way, what is the best backend to fulfill the task ? (better quality and 
less memory leackage ?)

Thank you

-- 

Emanuele Passera

Tele-Rilevamento Europa - T.R.E. s.r.l.
a POLIMI spin-off company
Via Vittoria Colonna, 7
20149 Milano - Italia
tel.: +39.02.4343.121
fax: +39.02.4343.1230
e-mail: emanuele.pass...@treuropa.com
web: www.treuropa.com
-


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Color Map.

2009-01-15 Thread Oscar ¿?



Hello
folks,



I´m a new user of this forum. I'm trying to work in Python at the moment but
it´s quite difficult for me. My first question is if it is possible to do Color
Maps in Matplotlib in the same manner of the "mesh" function in
Matlab. Could you help me anybody?



Thanks in advance.



Regards.


_
Nuevo Windows Live, un mundo lleno de posibilidades. Descúbrelo.
http://www.microsoft.com/windows/windowslive/default.aspx--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Vertical alignment of a text

2009-01-15 Thread Jae-Joon Lee
va="baseline" does not work?

-JJ


On Thu, Jan 15, 2009 at 3:05 AM,   wrote:
>>Dimension of a text in mpl is renderer-dependent in general.
>>Each renderer has "get_text_width_height_descent" method which returns
>>width, height, and descent of the given text.
>>If you're only interested in latex-rendered text, you may use the
>>get_text_width_height_descent() method in the TexManager.
>>
>>As you see, it is possible to know the dimension of the text, but
>>these functionalities are not exposed to the user, and a bit difficult
>> to use unless you're familiar with mpl. If you let us know for what
>>you need to use the depth of the text, we may come up with some simple
>>solution.
>>
>>Regards,
>>
>>-JJ
> Hello,
>
> my purpose would be to align several formula for example.
>
>
>
> Regrads,
>
> Christophe.
>
>

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Segmentation fault when calling imshow with complex array

2009-01-15 Thread Philipp Lies


Hi,

I have a problem with pyplot. When I'm passing an numpy array with complex
entries to imshow I receive the error message:
TypeError: array cannot be safely cast to required type
Which is ok, when I thereafter call imshow with a valid image (i)python
segfaults. Sometimes it even segfaults instead of the above error message:

Python 2.5.2 (r252:60911, Oct 5 2008, 19:29:17)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from matplotlib.pyplot import *
/usr/lib/python2.5/site-packages/pytz/__init__.py:29: UserWarning: Module
dateutil was already imported from
/var/lib/python-support/python2.5/dateutil/__init__.py, but
/var/lib/python-support/python2.5 is being added to sys.path
from pkg_resources import resource_stream
>>> from numpy import *
>>> X = random.uniform(size=(10,10))
>>> Xc = X*1j
>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(X)

>>> imshow(Xc)
Segmentation fault

The only deterministic behaviour after calling imshow with a complex array
is that it segfaults anytime. Quite annoying because I forget to convert to
real quite often 8-).

I use matplotlib, python, and numpy with the latest backport version
available in Ubuntu Intrepid 8.10 amd64 (numpy 1.1.1, python 2.5.2,
matplotlib
0.98.3). Does also crash in ipython 0.9.1 with and without -pylab flag
started.

I filed a bug but so far no one responded, so maybe here's some help.
http://sourceforge.net/tracker2/?func=detail&aid=2502029&group_id=80706&atid=560720

Cheers

Phil
-- 
View this message in context: 
http://www.nabble.com/Segmentation-fault-when-calling-imshow-with-complex-array-tp21473274p21473274.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Vertical alignment of a text

2009-01-15 Thread projetmbc
Title: Flashmail




>Dimension of a text in mpl is renderer-dependent in general. >Each renderer has "get_text_width_height_descent" method which returns >width, height, and descent of the given text. >If you're only interested in latex-rendered text, you may use the >get_text_width_height_descent() method in the TexManager. > >As you see, it is possible to know the dimension of the text, but >these functionalities are not exposed to the user, and a bit difficult >
to use unless you're familiar with mpl. If you let us know for what >you need to use the depth of the text, we may come up with some simple >solution. > >Regards, > >-JJ Hello,
my purpose would be to align several formula for example.
 
Regrads,
Christophe.
 


--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users