Re: [Matplotlib-users] Colorbar not working with specgram

2009-07-22 Thread davide lasagna
Thanks Eric for pointing out this. However i've found that psd and
specgram plot 10*log10*(Pxx/max(Pxx)), so i'll have a range from 0 db
down. 
Anyway, what do you mean by should not be axes method?
Do you mean using the array output of specgram and psd and plotting that
result by myself?

Cheers

Davide
On Tue, 2009-07-21 at 09:12 -1000, Eric Firing wrote:
 davide lasagna wrote:
  Hello everybody,
  this is my first post in this list. 
  
  I'm plotting a spectrogram with
  
  Pxx, freqs, bins, im = specgram(y, nfft=256, f_sampling=12000)
  
  and i want to add a colorbar with
  
  colorbar()
  
  
  The problem is that the color scale seems to be wrong with respect to
  the data in Pxx, i.e. Pxx is of the order of 1e-2 while in the colorbar
  i have tick values spanning from -20 to -180. What is the problem??
 
 specgram and psd plot power in decibels: 10*log10(Pxx).
 
 Because they involve heavy computation and application-specific choices, 
 like the decibel scale, they really should not be axes methods.
 
 You can make a function plot the spectrogram however you like by looking 
 at the source code in the Axes.specgram method (the pyplot specgram 
 function is just a thin wrapper for this method), which is using 
 mlab.specgram to do the calculation and is then just scaling and plotting.
 
 Eric
 
 
  
  Thanks in advance!
  
  
  Davide
  
  
  --
  Enter the BlackBerry Developer Challenge  
  This is your chance to win up to $100,000 in prizes! For a limited time, 
  vendors submitting new applications to BlackBerry App World(TM) will have
  the opportunity to enter the BlackBerry Developer Challenge. See full prize 
   
  details at: http://p.sf.net/sfu/Challenge
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 


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


Re: [Matplotlib-users] Colorbar not working with specgram

2009-07-22 Thread Eric Firing
davide lasagna wrote:
 Thanks Eric for pointing out this. However i've found that psd and
 specgram plot 10*log10*(Pxx/max(Pxx)), so i'll have a range from 0 db
 down. 
Aha, I wasn't looking closely enough!

 Anyway, what do you mean by should not be axes method?
That was a side remark about what the Axes class should do or not do. I 
would prefer that it stick to plotting.  For example, at present it does 
not have a method for empirical orthogonal functions, or for 
wavelets--and that's good, it shouldn't.  Numerical code (usually in 
numpy or scipy) should do the calculations, and then the result should 
be plotted using Axes methods or pyplot functions for line plotting, 
contouring, making images, etc.  So getting back to the specgram, I 
would prefer that it be given as an example--a script combining the 
calculation with the plotting--rather than having calculation and 
plotting done in an Axes method.
 Do you mean using the array output of specgram and psd and plotting that
 result by myself?

The calculations are being done by functions in the matplotlib.mlab 
module, so yes, I suggest using those functions directly (not the pyplot 
functions that wrap the Axes methods that call the mlab functions and 
then plot the result) and then doing your own scaling and plotting.  The 
Axes specgram method might guide you in the latter (giving an example of 
how to use imshow, for example), but if you write your own function you 
can make it do exactly what you want instead of accepting the scaling 
choice imposed by the Axes method.

Eric

 
 Cheers
 
 Davide
 On Tue, 2009-07-21 at 09:12 -1000, Eric Firing wrote:
 davide lasagna wrote:
 Hello everybody,
 this is my first post in this list. 

 I'm plotting a spectrogram with

 Pxx, freqs, bins, im = specgram(y, nfft=256, f_sampling=12000)

 and i want to add a colorbar with

 colorbar()


 The problem is that the color scale seems to be wrong with respect to
 the data in Pxx, i.e. Pxx is of the order of 1e-2 while in the colorbar
 i have tick values spanning from -20 to -180. What is the problem??
 specgram and psd plot power in decibels: 10*log10(Pxx).

 Because they involve heavy computation and application-specific choices, 
 like the decibel scale, they really should not be axes methods.

 You can make a function plot the spectrogram however you like by looking 
 at the source code in the Axes.specgram method (the pyplot specgram 
 function is just a thin wrapper for this method), which is using 
 mlab.specgram to do the calculation and is then just scaling and plotting.

 Eric


 Thanks in advance!


 Davide


 --
 Enter the BlackBerry Developer Challenge  
 This is your chance to win up to $100,000 in prizes! For a limited time, 
 vendors submitting new applications to BlackBerry App World(TM) will have
 the opportunity to enter the BlackBerry Developer Challenge. See full prize 
  
 details at: http://p.sf.net/sfu/Challenge
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 --
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


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


Re: [Matplotlib-users] I really can't get into hist() barstacked

2009-07-22 Thread ms
Sandro Tosi ha scritto:
 On Wed, Jul 22, 2009 at 10:25, msdeviceran...@gmail.com wrote:
 Sandro Tosi ha scritto:
 Hi all,
 I'd like to do a histogram with barstacked style. Well, I'm not able
 to make it in any way :(

 - what is the format of the the data to pass?
 - what's the value of bins? (related to the above question, I suppose)

 for example, let's say I want to plot this series

 s1 = 2,3,6,3,1
 s2 = 1,2,2,4,1
 s3 = 4,1,0,3,7

 what's the format of data to pass to hist() ? by row? by column?

 Thanks a lot in advance,
 I think hist() *computes* histograms ; you can find information here:

 http://matplotlib.sourceforge.net/api/pyplot_api.html
 
 and infact I want a barstacked histogram

So you want to
1) compute your histogram from your series of values and then
2) display the several histograms as a stacked bar graph

or just
1) display already-calculated histogram values as a stacked bar graph

These are two different things. Since it seems you want to pass directly
s1,s2,s3, it seems that they are your already calculated histogram
values. In this case hist() is of no utility for you.

 It seems from your example that you already have the histogram computed
 
 no, I just have a series of lists to plot, I didn't compute anything.

Ok, so you want a bar graph and not to compute a histogram.

 and that you want to plot the bar graph; in this case you should look to
  bar()

 In the page linked above you find also the example on how to do a
 barstacked graph.
 
 sure, for 2 data sets might be fine: but what for 10 ? how to use the
 bottom argument in that case?

Ehm, it seems pretty straighforward to me.
I attach the same example of the webpage but extended with three bar
graphs stacked. I admit that the fact the example used tuples for the
values made it unnecessarily awkward; using numpy arrays everything goes
to place:

#!/usr/bin/env python
# a stacked bar plot with errorbars
import numpy as np
import matplotlib.pyplot as plt


N = 5
menMeans   = np.array([20, 35, 30, 35, 27])
womenMeans = np.array([25, 32, 34, 20, 25])
xMeans = np.array([17, 11, 43, 5, 18])
menStd = (2, 3, 4, 1, 2)
womenStd   = (3, 5, 2, 3, 3)
ind = np.arange(N)# the x locations for the groups
width = 0.35   # the width of the bars: can also be len(x) sequence

p1 = plt.bar(ind, menMeans,   width, color='r', yerr=womenStd)
p2 = plt.bar(ind, womenMeans, width, color='y',
 bottom=menMeans, yerr=menStd)
p3 = plt.bar(ind, xMeans, width, color='b', bottom=womenMeans+menMeans)


plt.ylabel('Scores')
plt.title('Scores by group and gender')
plt.xticks(ind+width/2., ('G1', 'G2', 'G3', 'G4', 'G5') )
plt.yticks(np.arange(0,81,10))
plt.legend( (p1[0], p2[0], p3[0]), ('Men', 'Women','Aliens') )

plt.show()


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


Re: [Matplotlib-users] centering axis ticks labels

2009-07-22 Thread Johann Cohen-Tanugi
hello, anyone has an idea about how to get this right?
thanks a lot in advance,
Johann

Johann Cohen-Tanugi wrote:
 hi there, I stumbled into yet another problem, see script attached. 
 Now there are 10 pixels and 10 label values on each axis, but I get 
 only half the ticks, and as a result half the labels get discarded... 
 How can I specify the number of ticks it uses?
 Note that I could use plt.pcolor(np.array(EMINS),np.array(ROIS),d) and 
 at least the labelling would be correct, but the pixels are now more 
 or less wide depending on the interval between values, which was not 
 intended

 thanks a lot in advance for your help,
 Johann

 Johann Cohen-Tanugi wrote:
 Hello, how can I center axis tick labels, so that the labels ends up 
 at the center between 2 ticks.

 thanks in advance,
 Johann

 --
  

 Enter the BlackBerry Developer Challenge  This is your chance to win 
 up to $100,000 in prizes! For a limited time, vendors submitting new 
 applications to BlackBerry App World(TM) will have
 the opportunity to enter the BlackBerry Developer Challenge. See full 
 prize  details at: http://p.sf.net/sfu/Challenge
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   
 

 --
 Enter the BlackBerry Developer Challenge  
 This is your chance to win up to $100,000 in prizes! For a limited time, 
 vendors submitting new applications to BlackBerry App World(TM) will have
 the opportunity to enter the BlackBerry Developer Challenge. See full prize  
 details at: http://p.sf.net/sfu/Challenge
 

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

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


Re: [Matplotlib-users] I really can't get into hist() barstacked

2009-07-22 Thread ms
Sandro Tosi ha scritto:
 I got only data values, nothing already computed (for whatever you
 mean by that), and I want to plot stacked bars with those values
 (either by row or by column).

Ok, I see.

 It seems from your example that you already have the histogram computed
 no, I just have a series of lists to plot, I didn't compute anything.
 Ok, so you want a bar graph and not to compute a histogram.
 
 what is the difference? maybe I didn't get it right ;)

Oh, sorry, I thought it was common knowledge. That's why I didn't
understand at beginning :)

A histogram is a *statistical technique* which takes a vector of data,
classifies them into bins (usually magnitude intervals), counts the
number of data points into each bin and returns another vector with the
number of data points for each bin.

It is a technique to get an approximation of the distribution underlying
your data; it is not the only one (for example I am a big fan of kernel
density estimation, which is, roughly speaking, the continuous extension
of the histogram)

A bar graph is a representation of data as bars of different heights.
Usually people display histograms with bar graphs, each bar being a bin,
and for this reason they often confuse the two things :)

But they're two different and quite unrelated things: there's nothing
intrinsically wrong in plotting histograms as line or scatter plots, for
example, and you can do bar graphs of things which are not histograms.

So it seems you want a bar graph :),and that's why hist() is of little
help for you.

 In the page linked above you find also the example on how to do a
 barstacked graph.
 sure, for 2 data sets might be fine: but what for 10 ? how to use the
 bottom argument in that case?
 Ehm, it seems pretty straighforward to me.
 ...
 p3 = plt.bar(ind, xMeans, width, color='b', bottom=womenMeans+menMeans)
 
 do you really expect it to be straightforward for 10, 100 or for any
 other dynamically generated data? let's imagine today I get 15 sets of
 data, tomorrow 20, the next  day 7. I cannot do that by hand, and I
 want some general way to get stacked by dynamically adaptable to more
 columns with more blocks in them.

I didn't try, but isn't it easily done with a for cycle? Instead of
having p1,p2,p3 you have a vector pN=[...] where you append the bars,
and the bottom is the sum of the previous values of your bars.

Not counting the fact that if you have 100 data sets, maybe a stacked
bar graph begins to be confusing ;) but hey, that's your choice! :D

m.


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


Re: [Matplotlib-users] Problems with autofmt_xdate()

2009-07-22 Thread Domenico Nappo
Hi there,

I've upgraded to python 2.6, install all packages I need for that version
(using matplotlib windows installer with gtk support found here:
http://www.lfd.uci.edu/~gohlke/#pythonlibs ) and now everything seems to be
ok.

Thanks again.

2009/7/22 Domenico Nappo domenico.na...@gmail.com



 2009/7/21 John Hunter jdh2...@gmail.com


  I have the suspect that matplotlib windows support simply doesn't
 exist:)
  I'll try prepackaged windows distributions like EPD or Python(x,y) and
 hope
  this will solve this issue...


 I'm pretty sure they do not package mpl with the gtk backend, but
 Christoph Gohlke has a version that does

 http://www.lfd.uci.edu/~gohlke/#pythonlibshttp://www.lfd.uci.edu/%7Egohlke/#pythonlibs

 Oh, finally...we have found a package with gtk support. Thanks. I will try
 it. Even if I've already downloaded 240 MB of EDP and I'd like to try it as
 well.
 Thank you very much to you two!

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


[Matplotlib-users] imshow background and/or colour to alpha

2009-07-22 Thread massimo sandal
Hi,

I am trying to do a plot where small images are used as markers at
definite coordinate positions (just to make myself clear: I am trying
to see how the shape of a polymer changes with different parameters,
so I want little icons of the polymer placed at the x,y of the
parameters).

Doing that with imshow() , putting images as sub-matrixes etc. seems
doable. However problem is my images have a black background, and
correspondingly it seems that the RGB 0,0,0 value of the matrix is
shown -kinda correctly- as black (a zeros filled canvas is shown as
black).

I wonder: Is there a default way to tell imshow() that I want a
certain colour (in this case, black) , and that colour only, to be
alpha? Or do I have to manually change the matrix?

Thanks!

m.

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


[Matplotlib-users] problem with svn install

2009-07-22 Thread davide lasagna
Hi all,
I have a problem with an svn install.
I've followed the instruciont on mpl website, that is:

$ svn co 
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib 
matplotlib
$ cd matplotlib
$ python setupegg.py develop

Please note that i've run the last command with sudo as i'm explicitly asked to 
do so.

Then if  i run this simple test script: 

from pylab import *
plot([1,2,3])
show()

from the command line as

python test.py --verbose-helpful

i get thise output:

dav...@davide-desktop:~$ python test.py --verbose-helpful
$HOME=/home/davide
CONFIGDIR=/home/davide/.matplotlib
matplotlib data path /home/davide/partizione/matplotlib/lib/matplotlib/mpl-data
loaded rc file 
/home/davide/partizione/matplotlib/lib/matplotlib/mpl-data/matplotlibrc
matplotlib version 0.98.6svn
verbose.level helpful
interactive is False
units is False
platform is linux2
Traceback (most recent call last):
  File mio, line 1, in module
from pylab import *
  File /home/davide/partizione/matplotlib/lib/pylab.py, line 1, in module
from matplotlib.pylab import *
  File /home/davide/partizione/matplotlib/lib/matplotlib/pylab.py, line 206, 
in module
from matplotlib import mpl  # pulls in most modules
  File /home/davide/partizione/matplotlib/lib/matplotlib/mpl.py, line 1, in 
module
from matplotlib import artist
  File /home/davide/partizione/matplotlib/lib/matplotlib/artist.py, line 5, 
in module
from transforms import Bbox, IdentityTransform, TransformedBbox, 
TransformedPath
  File /home/davide/partizione/matplotlib/lib/matplotlib/transforms.py, line 
34, in module
from matplotlib._path import affine_transform
ImportError: /home/davide/partizione/matplotlib/lib/matplotlib/_path.so: failed 
to map segment from shared object: Operation not permitted

Could it be that i've installed in the wrong directory? If yes how can i cope 
with this?
Thanks in advance for any help.


Davide








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


[Matplotlib-users] animate histogram

2009-07-22 Thread Alan G Isaac
Animating a line plot is well covered in the Cookbook:
http://www.scipy.org/Cookbook/Matplotlib/Animations

Can anyone offer a hint or two for animating a histogram?

Thanks,
Alan Isaac

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


Re: [Matplotlib-users] problem with svn install

2009-07-22 Thread Gökhan SEVER
On Wed, Jul 22, 2009 at 11:47 AM, Jouni K. Seppänen j...@iki.fi wrote:

 davide lasagna lasagnadav...@gmail.com writes:

  ImportError:
  /home/davide/partizione/matplotlib/lib/matplotlib/_path.so: failed to
  map segment from shared object: Operation not permitted
 
  Could it be that i've installed in the wrong directory? If yes how can
  i cope with this?

 Apparently this could be caused by SELinux (good luck with configuring
 that correctly), or perhaps your /home filesystem is mounted with the
 noexec option to prevent users from running their own code. Ask your
 system administrator how to install libraries so that Python can call
 dlopen on them.

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



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



I also have been bitten by SELinux a couple times. On my personal Fedora 11
laptop, and previously on FC10 my resolution was to completely disable
SELinux to eliminate installation and running issues.

Fortunately, I have not dealt with administrative restrictions on our
machines that sit in the lab. Once I heard of a complain in this regard
sys-admin will be the first to know after me :)

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


Re: [Matplotlib-users] PDF backend errors out; PNG works fine

2009-07-22 Thread John Kerenyi
Thank you for your response. Your response made me wonder how the script would 
operate in a non-graphic environment--I had tested it on a login node but not 
on a computing node. It appears that even though I have no need for any graphic 
display, the modules I am loading expect to have it nonetheless. I invoke 
matplotlib using the standard import matplotlib.pyplot as plt line. Here is 
the output when run on a compute node:

-

[ac.jkere...@n123 pygraph]$ ./run_pygraph.py png
Creating Top 100 V/C ratios graph...
Traceback (most recent call last):
  File ./run_pygraph.py, line 566, in module
GraphTop100VC (Top100VCFilename)
  File ./run_pygraph.py, line 326, in GraphTop100VC
fig=plt.figure()
  File /soft/python/lib/python2.6/site-packages/matplotlib/pyplot.py, line 
251, in figure
**kwargs)
  File 
/soft/python/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py,
 line 90, in new_figure_manager
window = Tk.Tk()
  File /soft/python/lib/python2.6/lib-tk/Tkinter.py, line 1643, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, 
wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

-

Can anyone advise if there another way to invoke matplotlib that does not 
require graphic support?

With respect to your suggestion that I run python setup.py build, I don't seem 
to have the necessary permissions but the sysadmin is very helpful and once I 
have a little more information on the new problem I'll get his help again.

Thanks again,

John Kerenyi

-Original Message-
From: Jouni K. Seppänen [mailto:j...@iki.fi] 
Sent: Wednesday, July 22, 2009 9:38 AM
To: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] PDF backend errors out; PNG works fine

John Kerenyi jo...@moval.org writes:

   File
 /soft/python/lib/python2.6/site-packages/matplotlib/backends/backend_
 pd
 f.py, line 44, in module
 from matplotlib import ttconv
 ImportError:
 /soft/python/lib/python2.6/site-packages/matplotlib/ttconv.so: 
 undefined
 symbol: _ZTVSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE

Sounds like a mismatch between C++ libraries on the system where matplotlib was 
built and where it is being used. You mentioned a cluster; perhaps your 
sysadmin compiled matplotlib on a special node that has more libraries 
installed than the computation nodes. I don't know how to fix this, but as a 
first step you could try compiling matplotlib on a computation node (submit 
something like python setup.py build as a job the same way you would submit 
another task on the
cluster) and seeing if that gives more clues about what is missing.

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


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


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


Re: [Matplotlib-users] PDF backend errors out; PNG works fine

2009-07-22 Thread Michael Droettboom
You can use the Agg or PDF backends to run matplotlib without 
display support:

import matplotlib
matplotlib.use(PDF)

Cheers,
Mike

John Kerenyi wrote:
 Thank you for your response. Your response made me wonder how the script 
 would operate in a non-graphic environment--I had tested it on a login node 
 but not on a computing node. It appears that even though I have no need for 
 any graphic display, the modules I am loading expect to have it nonetheless. 
 I invoke matplotlib using the standard import matplotlib.pyplot as plt 
 line. Here is the output when run on a compute node:

 -

 [ac.jkere...@n123 pygraph]$ ./run_pygraph.py png
 Creating Top 100 V/C ratios graph...
 Traceback (most recent call last):
   File ./run_pygraph.py, line 566, in module
 GraphTop100VC (Top100VCFilename)
   File ./run_pygraph.py, line 326, in GraphTop100VC
 fig=plt.figure()
   File /soft/python/lib/python2.6/site-packages/matplotlib/pyplot.py, line 
 251, in figure
 **kwargs)
   File 
 /soft/python/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py,
  line 90, in new_figure_manager
 window = Tk.Tk()
   File /soft/python/lib/python2.6/lib-tk/Tkinter.py, line 1643, in __init__
 self.tk = _tkinter.create(screenName, baseName, className, interactive, 
 wantobjects, useTk, sync, use)
 _tkinter.TclError: no display name and no $DISPLAY environment variable

 -

 Can anyone advise if there another way to invoke matplotlib that does not 
 require graphic support?

 With respect to your suggestion that I run python setup.py build, I don't 
 seem to have the necessary permissions but the sysadmin is very helpful and 
 once I have a little more information on the new problem I'll get his help 
 again.

 Thanks again,

 John Kerenyi

 -Original Message-
 From: Jouni K. Seppänen [mailto:j...@iki.fi] 
 Sent: Wednesday, July 22, 2009 9:38 AM
 To: matplotlib-users@lists.sourceforge.net
 Subject: Re: [Matplotlib-users] PDF backend errors out; PNG works fine

 John Kerenyi jo...@moval.org writes:

   
   File
 /soft/python/lib/python2.6/site-packages/matplotlib/backends/backend_
 pd
 f.py, line 44, in module
 from matplotlib import ttconv
 ImportError:
 /soft/python/lib/python2.6/site-packages/matplotlib/ttconv.so: 
 undefined
 symbol: _ZTVSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE
 

 Sounds like a mismatch between C++ libraries on the system where matplotlib 
 was built and where it is being used. You mentioned a cluster; perhaps your 
 sysadmin compiled matplotlib on a special node that has more libraries 
 installed than the computation nodes. I don't know how to fix this, but as a 
 first step you could try compiling matplotlib on a computation node (submit 
 something like python setup.py build as a job the same way you would submit 
 another task on the
 cluster) and seeing if that gives more clues about what is missing.

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


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


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

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


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


[Matplotlib-users] SourceForge is telling me that there are no mirrors for the windows installer

2009-07-22 Thread Mike Waters
Is anyone else having this problem? Is there another website that I can 
try?

-mike w.

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


Re: [Matplotlib-users] problem with svn install (Davide Lasagna)

2009-07-22 Thread davide lasagna
Well,
actually i'm using Ubuntu  at work on a virtual machine, and the svn copy is
in a partition mounted at boot by a line in /etc/fstab.
If i remember correctly this filesystem is mounted with options users. I'm
at home now, i'll try with the exec option tomorrow.
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] SourceForge is telling me that there are no mirrors for the windows installer

2009-07-22 Thread Mike Waters
Never mind I found a mirror at 
http://www.lfd.uci.edu/~gohlke/download/matplotlib-0.98.5.3.win32-py2.6.zip

-mike w.


Mike Waters wrote:
 Is anyone else having this problem? Is there another website that I can 
 try?

 -mike w.

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


   


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


[Matplotlib-users] Turning off the timezone (and more) in AutoDateFormatter

2009-07-22 Thread Christopher Barker
Hi all,

I'm passing in None for the timezone in AutoDateFormatter.

What I am getting is UTC, but what I want is nothing.

Looking at the code, I see lines like:

 self._formatter = DateFormatter(%H:%M:%S %Z, self._tz)

so my None is getting passed through. Then in DateFormatter, I see:

 if tz is None: tz = _get_rc_timezone()

Which looks like it's getting a timezone from an rc parameter. This
strikes me as not such a good idea. Far too easy to get the timezone
wrong -- I'm not sure there should be such a thing as a default time zone.

However, the issue at hand is that I want to not show the timezone at
all. I would have thought that None would be a good way to spell that,
but it's taken already to mean default.

So that means editing/overriding AutoDateFormatter. The way it's
written, I pretty much have to re-write the entire thing, which isn't so
bad, but it might be nicer if we could make it easier to override just
part of it.

One idea:

Some say that the right way to spell case/switch in Python is a 
dict, rather than a collection of if--elifs. So in this case, we could 
make a dict of format strings, something like below.

I've tried this, and I can now easily override the formatting for a 
particular time range, like so:

 Formatter = mpl.dates.AutoDateFormatter(locator, tz=None)
 # edit the format strings to remove the TZ spec
 # this only works with my custom version of AutoDateLocator
 Formatter.format_strings[1.0/24.0] = %H:%M:%S

I do agree with the comments that there are other ways to improve this,
but maybe this is a start.

-Chris


class AutoDateFormatter(ticker.Formatter):
 
 This class attempts to figure out the best format to use.  This is
 most useful when used with the :class:`AutoDateLocator`.
 

 # This can be improved by providing some user-level direction on
 # how to choose the best format (precedence, etc...)

 # Perhaps a 'struct' that has a field for each time-type where a
 # zero would indicate don't show and a number would indicate
 # show with some sort of priority.  Same priorities could mean
 # show all with the same priority.

 # Or more simply, perhaps just a format string for each
 # possibility...

 def __init__(self, locator, tz=None):
 self._locator = locator
 self._formatter = DateFormatter(%b %d %Y %H:%M:%S %Z, tz)
 self._tz = tz


 self.format_strings = { 365.0 : %Y,
  30.0 : %b %Y,
   1.0 : %b %d %Y,
   7.0 : %b %d %Y,
1.0/24.0  : %H:%M:%S %Z,
1.0/(24*60)   : %H:%M:%S %Z,
1.0/(24*3600) : %H:%M:%S %Z,
}
 self.fallback_format = %b %d %Y %H:%M:%S %Z

 def __call__(self, x, pos=0):
 scale = float( self._locator._get_unit() )

 f_string = self.format_strings.get(scale, self.fallback_format)

 self._formatter = DateFormatter(f_string, self._tz)


 return self._formatter(x, pos)



-- 
Christopher Barker, Ph.D.
Oceanographer

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

chris.bar...@noaa.gov

-- 
Christopher Barker, Ph.D.
Oceanographer

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

chris.bar...@noaa.gov

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


[Matplotlib-users] Two different definitions of autocorrelation?

2009-07-22 Thread Michael Lerner
Hi,

I'm used to the following definition of autocorrelation:

R(\tau) = \frac{(X_t - \mu)(X_{t+\tau}-\mu)}{\sigma^2}

However, it looks like acorr is just giving me

R(\tau) = \sum{X_t*X_{t+\tau}}

Just specifying normed=True doesn't get the first formula. Is there some
trivial option that I've missed?

Here's what I did:

It's easy enough to subtract \mu from my timeseries, but when I ask acorr to
normalize things for me, I get the whole timeseries normalized by the value
of R(0):

if normed: c/= np.dot(x,x)

I really do want the formula I gave, which requires each point of the
autocorrelation to be averaged separately. So, I modified my local version
of acorr to say

if normed:
nrm = arange(len(x))
nrm = hstack((nrm,nrm[:-1][::-1]))*std(x)**2
c /= nrm


Thanks,

-michael

-- 
Michael Lerner, Ph.D.
IRTA Postdoctoral Fellow
Laboratory of Computational Biology NIH/NHLBI
5635 Fishers Lane, Room T909, MSC 9314
Rockville, MD 20852 (UPS/FedEx/Reality)
Bethesda MD 20892-9314 (USPS)
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] log plots do not work when using base 2

2009-07-22 Thread Barnette, Daniel W
I've written a python gui to matplotlib which allows the user to plot either 
cartesian, semi-log, or log-log plots. Log plots can be generated for typical 
base values except for base 2. Is this a bug, or is there some reason that 
matplotlib does not do log plots using base 2?

Using base 2, the log-log plot error is:

-- begin snippet -
Exception in Tkinter callback
Traceback (most recent call last):
  File C:\python251_102507\lib\lib-tk\Tkinter.py, line 1403, in __call__
return self.func(*args)
  File C:\python251_102507\lib\site-packages\matplotlib\backends\backend_tkagg.
py, line 211, in resize
self.show()
  File C:\python251_102507\lib\site-packages\matplotlib\backends\backend_tkagg.
py, line 214, in draw
FigureCanvasAgg.draw(self)
  File C:\python251_102507\lib\site-packages\matplotlib\backends\backend_agg.py
, line 261, in draw
self.figure.draw(self.renderer)
  File C:\python251_102507\lib\site-packages\matplotlib\figure.py, line 759, i
n draw
for a in self.axes: a.draw(renderer)
  File C:\python251_102507\lib\site-packages\matplotlib\axes.py, line 1523, in
 draw
a.draw(renderer)
  File C:\python251_102507\lib\site-packages\matplotlib\axis.py, line 712, in
draw
for tick, loc, label in self.iter_ticks():
  File C:\python251_102507\lib\site-packages\matplotlib\axis.py, line 659, in
iter_ticks
minorLocs = self.minor.locator()
  File C:\python251_102507\lib\site-packages\matplotlib\ticker.py, line 1026,
in __call__
if len(subs)  1 or subs[0] != 1.0:
IndexError: index out of bounds

- end snippet -


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


[Matplotlib-users] waitfor/uiwait for show figure - wait until figure is closed - show next figure - wait until figure is closed - ...?

2009-07-22 Thread Jan Müller
Hi,

basically I'm looking for something like 'waitfor' or 'uiwait' from the Matlab.

I want to achieve is the following behavior:

- show a figure with several subplot/images to the user
- let the user click on some stuff to get coordinates, handles, ...
- wait until the user has closed the window
- based on the returned data, show a new figure and let the user select some 
more stuff
- repeat

What is the best way to do something similar in matplotlib?

I tried to use pylab.show() several times in the same script but then soon 
found out that this is not recommend / does not work.

Right now a combination of ion() and waitforbuttonpress seems to be the only 
way to achieve something similar to what i want to do, but i was wondering if 
there are other ways.

Any ideas?

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


Re: [Matplotlib-users] ipython --pylab without namespace pollution?

2009-07-22 Thread Ryan May
On Wed, Jul 22, 2009 at 6:09 PM, Christopher Barker
chris.bar...@noaa.govwrote:

 Hi folks,

 Does anyone know if there is a way to use ipython with the advantages of
 the -pylab option (separate gui thread, etc.), but without the whole
 pylab namespace getting sucked in?


Put this in your ~/.ipython/ipythonrc:

pylab_import_all 0

That gives you exactly what you want.  In my case, I also made a profile
that imports numpy as np and matplotlib.pyplot as plt, so that I can get the
equivalent of the ease pylab without the pollution.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How to disable imshow blurring/interpolation

2009-07-22 Thread Johan Carlin
Hi all,

I have just migrated from Matlab to Scipy. Matplotlib has been great so far.
However, I have some trouble getting imshow to behave like Matlab's image
function.

If you do image(eye(8)) in matlab, you get this:

http://www.flickr.com/photos/phineasgage/3746211714/

If you do imshow(eye(8)) in matplotlib, you get this:

http://www.flickr.com/photos/phineasgage/3745417651/

How do I get matplotlib to stop interpolating or blurring the borders in the
image? I have tried setting interpolation=None (the default behaviour), but
this has no effect.

I use matplotlib-0.98.5.2n2 as part of the Enthought distro on Red Hat 4
Linux. Any help would be greatly appreciated.

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


[Matplotlib-users] log base 2 plots

2009-07-22 Thread Barnette, Daniel W
I've written a python gui to matplotlib which allows the user to plot either 
cartesian, semi-log, or log-log plots. Log plots can be generated for typical 
base values except for base 2. Is this a bug, or is there some reason that 
matplotlib does not do log plots using base 2?

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


[Matplotlib-users] Help with plot_directive

2009-07-22 Thread dpo

Hello,

I am running Matplotlib 0.98.6svn compiled from source on OSX and Sphinx
0.6.2. I am trying the following example to test plot_directive

.. plot::

from numpy import linspace, sin
import matplotlib.pylab as plt
x = linspace(0.01,25, 1)
plt.plot(x, sin(x)/x)
plt.show()

When I 'make html', I get the warning messages:

/Users/dpo/local/dev/pyorder/doc/source/pymc60.rst:: WARNING: image file not
readable: build/plot_directive/inline/2d6f2be741.png
/Users/dpo/local/dev/pyorder/doc/source/pymc60.rst:: WARNING: image file not
readable: build/plot_directive/inline/2d6f2be741.pdf

and the plot is not embedded in my html page. The links 'hires.png' and
'pdf' do point to (readable) images, though. From build/html:

$ ls -l plot_directive/inline/
total 104
-rw-r--r--  1 dpo  dpo  41347 22 Jul 20:01 2d6f2be741.hires.png
-rw-r--r--  1 dpo  dpo   7370 22 Jul 20:01 2d6f2be741.pdf

Strangely, there is no 'png' link even though my conf.py specifies

plot_formats = ['png', 'hires.png', 'pdf']

If I look at the generated html, I notice that the img tag wants the png,
which doesn't exist. That is one problem.

The other problem is that the img tag searches for the png file in
build/plot_directive/inline/, which does not exist either.

The same happens in the LaTeX output. When I 'make latex' followed by 'make
all-pdf' from build/latex, I get the error message:

LaTeX Warning: File `build/plot_directive/inline/2d6f2be741.pdf' not found
on input line 499.
!pdfTeX error: pdflatex (file build/plot_directive/inline/2d6f2be741.pdf):
cannot find image file
 == Fatal error occurred, no output PDF file produced!

Indeed, the image files are in plot_directive/inline/ and not in
build/plot_directive/inline/. Changing the path in the .tex solves the
problem.

Thanks in advance,
Dominique

-- 
View this message in context: 
http://www.nabble.com/Help-with-plot_directive-tp24617359p24617359.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


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


Re: [Matplotlib-users] memory leak with PyQt4 plus savefig or print_figure

2009-07-22 Thread Alexander Baker


Ralph,

Perhaps time to migrate to Chaco API from Enthought? not sure if there is
Ubuntu support yet however.

Alex Baker

http://code.enthought.com/chaco/


Ralf Gommers-2 wrote:
 
 Hi,
 
 I am working on a PyQt4 application with some embedded MPL figures, and am
 also trying to save some figures as png's without displaying them. I am
 observing huge memory increases (10s or 100s of Mb) the moment I try to
 save
 a png. I reproduced the issue by combining two mpl examples,
 http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt4.htmland
 http://matplotlib.sourceforge.net/examples/api/agg_oo.html. Full code is
 attached. When pressing the save figure button, memory usage shoots up,
 multiple clicks keep sending it higher (although not monotonically).
 
 I tested on two different platforms
 - Matplotlib 98.5.2 and Python 2.6.2 on Ubuntu.
 - latest Enthought Python Distribution on Windows XP.
 
 The function that does the png saving is:
 
 def save_png():
 Save an image as a png file
 
 pngpath = 'test_mplsave.png'
 
 fig = Figure()
 canvas = FigureCanvas(fig)
 ax = fig.add_subplot(111)
 x = arange(5e3)
 ax.plot(x, sin(x))
 canvas.print_figure(pngpath)
 
 ## tried all things commented out below, all makes no difference ##
 #fig.savefig(pngpath)
 
 #del(fig)
 #del(canvas)
 #del(ax)
 
 #import matplotlib.pyplot as plt
 #plt.close(fig)
 
 #import gc
 #gc.collect()
 
 Commenting out the canvas.print_figure line fixes the issue.
 
 Am I doing something obviously wrong, or mixing two incompatible ways of
 doing things?
 
 Cheers,
 Ralf
 
 #!/usr/bin/env python
 
 # embedding_in_qt4.py --- Simple Qt4 application embedding matplotlib
 canvases
 #
 # Copyright (C) 2005 Florent Rougon
 #   2006 Darren Dale
 #
 # This file is an example program for matplotlib. It may be used and
 # modified with no restriction; raw copies as well as modified versions
 # may be distributed without limitation.
 
 import sys, os, random
 from PyQt4 import QtGui, QtCore
 
 from numpy import arange, sin, pi
 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as
 FigureCanvas
 from matplotlib.figure import Figure
 
 
 class MyMplCanvas(FigureCanvas):
 Ultimately, this is a QWidget (as well as a FigureCanvasAgg,
 etc.).
 def __init__(self, parent=None, width=5, height=4, dpi=100):
 fig = Figure(figsize=(width, height), dpi=dpi)
 self.axes = fig.add_subplot(111)
 # We want the axes cleared every time plot() is called
 self.axes.hold(False)
 
 self.compute_initial_figure()
 
 FigureCanvas.__init__(self, fig)
 self.setParent(parent)
 
 FigureCanvas.setSizePolicy(self,
QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
 FigureCanvas.updateGeometry(self)
 
 def compute_initial_figure(self):
 pass
 
 
 class MyStaticMplCanvas(MyMplCanvas):
 Simple canvas with a sine plot.
 def compute_initial_figure(self):
 t = arange(0.0, 3.0, 0.01)
 s = sin(2*pi*t)
 self.axes.plot(t, s)
 
 
 def save_png():
 Save an image as a png file
 
 pngpath = 'test_mplsave.png'
 
 fig = Figure()
 canvas = FigureCanvas(fig)
 ax = fig.add_subplot(111)
 x = arange(5e3)
 ax.plot(x, sin(x))
 #canvas.print_figure(pngpath)
 
 ## tried all things commented out below, all makes no difference ##
 #fig.savefig(pngpath)
 
 #del(fig)
 #del(canvas)
 #del(ax)
 
 #import matplotlib.pyplot as plt
 #plt.close(fig)
 
 #import gc
 #gc.collect()
 
 
 class ApplicationWindow(QtGui.QMainWindow):
 def __init__(self):
 QtGui.QMainWindow.__init__(self)
 self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
 self.setWindowTitle(application main window)
 
 self.file_menu = QtGui.QMenu('File', self)
 self.file_menu.addAction('Quit', self.fileQuit,
  QtCore.Qt.CTRL + QtCore.Qt.Key_Q)
 self.menuBar().addMenu(self.file_menu)
 
 self.help_menu = QtGui.QMenu('Help', self)
 
 self.main_widget = QtGui.QWidget(self)
 
 l = QtGui.QVBoxLayout(self.main_widget)
 sc = MyStaticMplCanvas(self.main_widget, width=5, height=4,
 dpi=100)
 dc = QtGui.QPushButton('Save image')
 l.addWidget(sc)
 l.addWidget(dc)
 
 self.main_widget.setFocus()
 self.setCentralWidget(self.main_widget)
 
 self.statusBar().showMessage(All hail matplotlib!, 2000)
 self.connect(dc, QtCore.SIGNAL(clicked()), save_png)
 
 def fileQuit(self):
 self.close()
 
 def closeEvent(self, ce):
 self.fileQuit()
 
 
 qApp = QtGui.QApplication(sys.argv)
 
 aw = ApplicationWindow()
 aw.setWindowTitle(Try saving a simple png image)
 aw.show()
 sys.exit(qApp.exec_())
 
 

[Matplotlib-users] bar charts can't handle datetimes with less than a day between datapoints?

2009-07-22 Thread Nick Seow
Hi,

I'm worried that I'm doing something stupid, but can't quite spot it.

testBarCharts() :- X axis in integers. Works fine.
testBarChartsDTMonths() :- X axis in datetimes, 1 month between data
points. Works fine
testBarChartsDTHours() :- X axis in datetimes, 1 hour between data
points. Bars seem to extend as far to the right as possible. When
printing the list of patches returned from plotting, the widths are
reported as 0.8, though.

Am I screwing up or is this a matplotlib bug? Using
matplotlib-0.98.5.3.win32-py2.6.exe and
numpy-1.3.0-win32-superpack-python2.6.exe

Many thanks,

Nick



import matplotlib.pyplot as plt
import matplotlib.dates
import datetime

# This works fine
def testBarCharts():
xs = [10,11,12,13]
ys = [100,300,200,600]

fig = plt.figure(figsize=(20,12)) # dims in inches
ax1 = fig.add_subplot(111)

ax1.set_ylabel(foo)

rects = ax1.bar(xs,ys,color=(1,0,0))
# debugging
print xs
print ys
for r in rects:
print r.get_xy(),r.get_width(),x,r.get_height()

fig.savefig(foo.png)
plt.close(fig)



# FIXME: This is all wonky
def testBarChartsDTHours():
xs = [ \
datetime.datetime(2009,6,29,10),
datetime.datetime(2009,6,29,11),
datetime.datetime(2009,6,29,12),
datetime.datetime(2009,6,29,13) ]
ys = [100,300,200,600]

fig = plt.figure(figsize=(20,12)) # dims in inches
ax1 = fig.add_subplot(111)

ax1.set_ylabel(foo)

ax1.xaxis_date()

min_x = min(xs)
max_x = max(xs)+datetime.timedelta(0,2*60*60)

rects = ax1.bar(xs,ys,color=(1,0,0))
# XXX note that all the rectangle dimensions look sane
print xs
print ys
for r in rects:
print r.get_xy(),r.get_width(),x,r.get_height()

ax1.set_xbound(min_x,max_x)

fig.savefig(foo1.png)
plt.close(fig)


# Works
def testBarChartsDTMonths():
xs = [ \
datetime.datetime(2009,6,1),
datetime.datetime(2009,7,1),
datetime.datetime(2009,8,1),
datetime.datetime(2009,9,1) ]
ys = [100,300,200,600]

fig = plt.figure(figsize=(20,12)) # dims in inches
ax1 = fig.add_subplot(111)

ax1.set_ylabel(foo)

ax1.xaxis_date()

min_x = min(xs)
max_x = max(xs)+datetime.timedelta(1)

rects = ax1.bar(xs,ys,color=(1,0,0))
# debugging
print xs
print ys
for r in rects:
print r.get_xy(),r.get_width(),x,r.get_height()

ax1.set_xbound(min_x,max_x)

fig.savefig(foo2.png)
plt.close(fig)



if __name__=='__main__':
testBarCharts()
testBarChartsDTMonths()
testBarChartsDTHours()

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


[Matplotlib-users] log base 2 plots

2009-07-22 Thread Barnette, Daniel W
I've written a python gui to matplotlib which allows the user to plot either 
cartesian, semi-log, or log-log plots. Log plots can be generated for typical 
base values except for base 2. Is this a bug, or is there some reason that 
matplotlib does not do log plots using base 2?

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


Re: [Matplotlib-users] ipython --pylab without namespace pollution?

2009-07-22 Thread John Hunter
On Wed, Jul 22, 2009 at 8:04 PM, Ryan Mayrma...@gmail.com wrote:
 On Wed, Jul 22, 2009 at 6:09 PM, Christopher Barker chris.bar...@noaa.gov
 wrote:

 Hi folks,

 Does anyone know if there is a way to use ipython with the advantages of
 the -pylab option (separate gui thread, etc.), but without the whole
 pylab namespace getting sucked in?

 Put this in your ~/.ipython/ipythonrc:

 pylab_import_all 0

 That gives you exactly what you want.  In my case, I also made a profile
 that imports numpy as np and matplotlib.pyplot as plt, so that I can get the
 equivalent of the ease pylab without the pollution.

Hey Ryan -- could you write up a sphinx/rest FAQ that describes all
these steps in detail, eg how you create the profile and how you start
ipython, so we can add it to the site docs?  If you are uncomfortable
with the docs, I can apply the patch.

Thanks
JDH

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


Re: [Matplotlib-users] How to disable imshow blurring/interpolation

2009-07-22 Thread Eric Firing
Johan Carlin wrote:
 Hi all,
 
 I have just migrated from Matlab to Scipy. Matplotlib has been great so 
 far. However, I have some trouble getting imshow to behave like Matlab's 
 image function.
 
 If you do image(eye(8)) in matlab, you get this:
 
 http://www.flickr.com/photos/phineasgage/3746211714/
 
 If you do imshow(eye(8)) in matplotlib, you get this:
 
 http://www.flickr.com/photos/phineasgage/3745417651/
 
 How do I get matplotlib to stop interpolating or blurring the borders in 
 the image? I have tried setting interpolation=None (the default 
 behaviour), but this has no effect.

interpolation='nearest'

Eric

 
 I use matplotlib-0.98.5.2n2 as part of the Enthought distro on Red Hat 4 
 Linux. Any help would be greatly appreciated.
 
 Johan
 
 
 
 
 --
 
 
 
 
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


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


Re: [Matplotlib-users] ipython --pylab without namespace pollution?

2009-07-22 Thread Ryan May
On Wed, Jul 22, 2009 at 8:34 PM, John Hunter jdh2...@gmail.com wrote:

 On Wed, Jul 22, 2009 at 8:04 PM, Ryan Mayrma...@gmail.com wrote:
  On Wed, Jul 22, 2009 at 6:09 PM, Christopher Barker 
 chris.bar...@noaa.gov
  wrote:
 
  Hi folks,
 
  Does anyone know if there is a way to use ipython with the advantages of
  the -pylab option (separate gui thread, etc.), but without the whole
  pylab namespace getting sucked in?
 
  Put this in your ~/.ipython/ipythonrc:
 
  pylab_import_all 0
 
  That gives you exactly what you want.  In my case, I also made a profile
  that imports numpy as np and matplotlib.pyplot as plt, so that I can get
 the
  equivalent of the ease pylab without the pollution.

 Hey Ryan -- could you write up a sphinx/rest FAQ that describes all
 these steps in detail, eg how you create the profile and how you start
 ipython, so we can add it to the site docs?  If you are uncomfortable
 with the docs, I can apply the patch.


I'm willing to.  However, I just noticed that with just the pylab_import_all
0, you get the import numpy as np and import matplotlib.pyplot as plt
automatically. Also, nicely, these don't show up when you type 'whos'.  This
is with ipython 0.9.1.  Should I just add the pylab_import_all 0 to the FAQ?

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] ipython --pylab without namespace pollution?

2009-07-22 Thread John Hunter
On Wed, Jul 22, 2009 at 8:50 PM, Ryan Mayrma...@gmail.com wrote:

 I'm willing to.  However, I just noticed that with just the pylab_import_all
 0, you get the import numpy as np and import matplotlib.pyplot as plt
 automatically. Also, nicely, these don't show up when you type 'whos'.  This
 is with ipython 0.9.1.  Should I just add the pylab_import_all 0 to the FAQ?

Should be enough, but it would be nice to have a little bit on how to
write a profile to add extra imports (eg scipy as sp)  to an ipython
profile and load it in the same FAQ.  Yes, they could find it reading
the ipython docs, but the easier it is to get the info the more useful
it will be.

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


[Matplotlib-users] plotting 2d or 3d normal distribution pdf

2009-07-22 Thread per freem
hi all,

i'm trying to find the function for the pdf of a multivariate normal pdf. i
know that multivariate_normal can be used to sample from the multivariate
normal distribution, but i just want to get the pdf for a given vector of
means and a covariance matrix. is there a function to do this?

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


Re: [Matplotlib-users] bar charts can't handle datetimes with less than a day between datapoints?

2009-07-22 Thread Nick Seow
Ah, thanks!

On Thu, Jul 23, 2009 at 12:18 PM, John Hunterjdh2...@gmail.com wrote:
 bar width or 1.0 corresponds to 1 day.  The default width to the bar
 command is 0.8, which is too thin for months, just right for days, and
 too wide for hours.  Eg, for hours do

  bar(x, y, width=0.8*1/24.)  # width is 0.8 hours

 for months, do something like

  bar(x, y, width=0.8*30/24.)  # width approx 80% of a month

It would be nice for the documentation to say something like width:
the widths of the bars as a proportion of the width of 1 day instead
of  width: the widths of the bars

Nick

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