[Matplotlib-users] Specifying X,Y Pairs For Line Plots

2007-11-25 Thread Rich Shepard
   I need to plot trapezoids as well as left- and right-shouldered straight
line plots. If I specify separate lists for the x values and their
corresponding y values, the plots are generated and displayed as needed.
However, I cannot specify the points as a list of tuples and have matplotlib
accept them.

   Example:
x,y = [(15,0.0), (30,1.0), (70,1.0) (85,0.0)]
p.plot (x,y)

Yields:
Traceback (most recent call last):
  File trapezoid.py, line 4, in ?
x,y = [(15,0.0), (30,1.0), (70,1.0) (85,0.0)]
TypeError: 'tuple' object is not callable

   I don't see how to do this in the User Guide, but I'm sure there must be a
way. Please pass me a pointer on how to accomplish this.

Rich

-- 
Richard B. Shepard, Ph.D.   |  IntegrityCredibility
Applied Ecosystem Services, Inc.|Innovation
http://www.appl-ecosys.com Voice: 503-667-4517  Fax: 503-667-8863

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
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


Re: [Matplotlib-users] Specifying X,Y Pairs For Line Plots

2007-11-25 Thread Darren Dale
On Sunday 25 November 2007 12:15:54 pm Rich Shepard wrote:
 x,y = [(15,0.0), (30,1.0), (70,1.0) (85,0.0)]

you need a , after that (70,1.0)

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
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


Re: [Matplotlib-users] Specifying X,Y Pairs For Line Plots

2007-11-25 Thread Rich Shepard
On Sun, 25 Nov 2007, Darren Dale wrote:

 you need a , after that (70,1.0)

   Thanks, Darren. Not enough caffine, I guess.

   However, now I get:

Traceback (most recent call last):
   File trapezoid.py, line 4, in ?
 x,y = [(15.0, 0.0), (30.0, 1.0), (70.0, 1.0), (85.0, 0.0)]
ValueError: too many values to unpack

which tells me something is still not correct.

Rich

-- 
Richard B. Shepard, Ph.D.   |  IntegrityCredibility
Applied Ecosystem Services, Inc.|Innovation
http://www.appl-ecosys.com Voice: 503-667-4517  Fax: 503-667-8863

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
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


Re: [Matplotlib-users] Specifying X,Y Pairs For Line Plots

2007-11-25 Thread Jouni K Seppänen
Rich Shepard [EMAIL PROTECTED] writes:

  x,y = [(15.0, 0.0), (30.0, 1.0), (70.0, 1.0), (85.0, 0.0)]
 ValueError: too many values to unpack

You are looking for the classic unzip trick:

x,y = zip(*[(15.0, 0.0), (30.0, 1.0), (70.0, 1.0), (85.0, 0.0)])

-- 
Jouni



-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
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


Re: [Matplotlib-users] Specifying X,Y Pairs For Line Plots

2007-11-25 Thread Rich Shepard

On Sun, 25 Nov 2007, Jouni K Seppänen wrote:


x,y = zip(*[(15.0, 0.0), (30.0, 1.0), (70.0, 1.0), (85.0, 0.0)])


Jouni,

  Thank you for pointing this out to me. I see that it's a builtin function
similar to map that assembles the first element of each tuple into a list
for the first variable, and the second element of each tuple into a list for
the second variable. How useful for my plotting needs!

Rich

--
Richard B. Shepard, Ph.D.   |  IntegrityCredibility
Applied Ecosystem Services, Inc.|Innovation
http://www.appl-ecosys.com Voice: 503-667-4517  Fax: 503-667-8863-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
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] viewing my data correctly

2007-11-25 Thread Bryan Fodness
I am wondering if there is a way to view my data with respect to the
physical size of what my array element is suppose to be.

I have an array that is 60 x 4000 where,
the first row has a height of 1.4
the next nine has a height of 1
the next forty has a height of 0.5
the next nine has a height of 1
and the last one has a height of 1.4

When viewing this with contourf or pcolor, the image is more narrow
than it should be.  Is there an easy way to view this properly.

Bryan

-- 
The game of science can accurately be described as a never-ending
insult to human intelligence.  - João Magueijo

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
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] Histogram on shared axis

2007-11-25 Thread Tom Johnson
Is it possible to have a figure with two-plots such that

   f(x) is plotted against x   onaxis 1  (on the right)

   histogram of f(x) is plotted horizontally (on the right) sharing
the y-axis of axis 1



(sorry, this is proportional font, ascii art)


f(x)
 ^
  |
  |
  |
 counts   -  x


I want count=0 to be on the shared y-axis.  Perhaps log of counts as
well...so normal histogram options.

Thanks.

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
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] os x leopard build step-by-step

2007-11-25 Thread John Hunter
A couple of weeks ago I got a new powerbook and installed leopard on
it, and decided to keep fairly detailed notes of the process of
getting developer svn versions of some of the scientific python tools
installed (matplotlib, ipython, numpy, scipy aka MINS).  The notes
will probably apply equally well for the released versions, but or
those of you embarking on getting a new OS X environment, up and
running, this might be helpful.  I tried to leave nothing to the
imagination so that this would be useful to newbies, so some of this
will be a bit tedious to unix or max veterans

== get access to the terminal ==

Put the Terminal on your dock launch bar.  It is in the
Applications-Utilities folder

== install gcc and other developer tools ==

Install XCode developer tools from the Leopard install CD under
optional packages.  Verify the install -- check for a working gcc

   gcc --version
  i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)

== get the mac python python release ==

The consensus is that the python that ships with Apple is broken and
should be replaced with the universal binary from the mac python
community.  Go to the mac python site for downloads and install the
python 2.5 universal binary from there

  http://www.pythonmac.org/packages/py25-fat/index.html

Verify the python install

  /usr/local/bin/python
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type help, copyright, credits or license for more information.

Make sure that /usr/local/bin is in your PATH before the Apple
defaults.  I added this to the front of my default .bash_profile

PATH=/usr/local/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}
export PATH

Start a new terminal instance and verify

   which python
  /usr/local/bin/python

Get whatever else you want from pythonmac.org

== get svn checkouts of MINS ==

I am going to be installing most things from svn since I need
developerversions of many packages, but you may just want to get the
latest stable releases from this pythonmac site.  In particular, I
always run svn ipython, numpy, scipy and matplotlibx

= ipython =

 svn co http://ipython.scipy.org/svn/ipython/ipython/trunk ipython
 cd ipython
 sudo python setup.py install

= numpy =

 svn co http://svn.scipy.org/svn/numpy/trunk numpy
 cd numpy
 sudo python setup.py install

= scipy =

 svn co http://svn.scipy.org/svn/scipy/trunk scipy

http://scipy.org/Installing_SciPy/Mac_OS_X gives step-by-step
instructions to install the vecLib Framework (should have been
done in step one of the developer tools above) g77 compiler, the
fftw libs, and the scipy build commands, do I won't repeat them
here.  The only gotcha was I got an internal compiler error
qelg.f:1: internal compiler error: vector VEC ... when I
downloaded the intel gfortran binary linked from the site, so I
grabbed the gfortran-intel-leopard-bin.tar.gz from
http://hpc.sourceforge.net/ and reinstalled using

sudo tar -xvzf gfortran-intel-leopard-bin.tar.gz -C /

   and then did a clean build of scipy


= matplotlib =

matplotlib wants a GUI, so I am going to try wxpython2.8, which is
available from the pythonmac ite.  Because I am interested in
installing the enthought tools which need wxython (eg traits UI) I'm
going to see if I can get a wx enabled build of mpl going.  I
installed wxPython2.8-osx-unicode-2.8.3.0-universal10.4-py2.5.dmg from
the pythonmac site and am crossing my fingers that I don't find myself
entangled in wx version hell.

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

matplotlib depends on libpng and freetype, both of which are provided
by the xcode package in /usr/X11R6, so I am going to point the mpl
build to that directory.  sys.platform is darwin, so edit
setupext.py and add '/usr/X11R6' to the basedir dictionary for the
'darwin' key.  You need to install pkgcong-0.22 from
http://pkgconfig.freedesktop.org/releases/ (just configure, sudo make
install it) so that matplotlib can use it to find an properly
configure png and freetype.  You will need to set the pkgcong path

   export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig

After all that, I could build mpl from svn with

   python setup.py build
   sudo python setup.py install

and successfully make a figure with

   ipython -pylab
   plot([1,2,3])

which used the wxagg backend.

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
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


Re: [Matplotlib-users] os x leopard build step-by-step

2007-11-25 Thread Jeremy Conlin
Thanks for posting these instructions.  Forgive me if this has already been
hashed out in previous emails, but do the instructions for iPython resolve
the readline issues in Leopard?
Thanks,
Jeremy

On Nov 25, 2007 11:12 PM, John Hunter [EMAIL PROTECTED] wrote:

 A couple of weeks ago I got a new powerbook and installed leopard on
 it, and decided to keep fairly detailed notes of the process of
 getting developer svn versions of some of the scientific python tools
 installed (matplotlib, ipython, numpy, scipy aka MINS).  The notes
 will probably apply equally well for the released versions, but or
 those of you embarking on getting a new OS X environment, up and
 running, this might be helpful.  I tried to leave nothing to the
 imagination so that this would be useful to newbies, so some of this
 will be a bit tedious to unix or max veterans

 == get access to the terminal ==

 Put the Terminal on your dock launch bar.  It is in the
 Applications-Utilities folder

 == install gcc and other developer tools ==

 Install XCode developer tools from the Leopard install CD under
 optional packages.  Verify the install -- check for a working gcc

   gcc --version
  i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)

 == get the mac python python release ==

 The consensus is that the python that ships with Apple is broken and
 should be replaced with the universal binary from the mac python
 community.  Go to the mac python site for downloads and install the
 python 2.5 universal binary from there

  http://www.pythonmac.org/packages/py25-fat/index.html

 Verify the python install

   /usr/local/bin/python
 Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
 [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
 Type help, copyright, credits or license for more information.

 Make sure that /usr/local/bin is in your PATH before the Apple
 defaults.  I added this to the front of my default .bash_profile


 PATH=/usr/local/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}
 export PATH

 Start a new terminal instance and verify

   which python
  /usr/local/bin/python

 Get whatever else you want from pythonmac.org

 == get svn checkouts of MINS ==

 I am going to be installing most things from svn since I need
 developerversions of many packages, but you may just want to get the
 latest stable releases from this pythonmac site.  In particular, I
 always run svn ipython, numpy, scipy and matplotlibx

 = ipython =

 svn co http://ipython.scipy.org/svn/ipython/ipython/trunk ipython
 cd ipython
 sudo python setup.py install

 = numpy =

 svn co http://svn.scipy.org/svn/numpy/trunk numpy
 cd numpy
 sudo python setup.py install

 = scipy =

 svn co http://svn.scipy.org/svn/scipy/trunk scipy

http://scipy.org/Installing_SciPy/Mac_OS_X gives step-by-step
instructions to install the vecLib Framework (should have been
done in step one of the developer tools above) g77 compiler, the
fftw libs, and the scipy build commands, do I won't repeat them
here.  The only gotcha was I got an internal compiler error
qelg.f:1: internal compiler error: vector VEC ... when I
downloaded the intel gfortran binary linked from the site, so I
grabbed the gfortran-intel-leopard-bin.tar.gz from
http://hpc.sourceforge.net/ and reinstalled using

sudo tar -xvzf gfortran-intel-leopard-bin.tar.gz -C /

   and then did a clean build of scipy


 = matplotlib =

 matplotlib wants a GUI, so I am going to try wxpython2.8, which is
 available from the pythonmac ite.  Because I am interested in
 installing the enthought tools which need wxython (eg traits UI) I'm
 going to see if I can get a wx enabled build of mpl going.  I
 installed wxPython2.8-osx-unicode-2.8.3.0-universal10.4-py2.5.dmg from
 the pythonmac site and am crossing my fingers that I don't find myself
 entangled in wx version hell.

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

 matplotlib depends on libpng and freetype, both of which are provided
 by the xcode package in /usr/X11R6, so I am going to point the mpl
 build to that directory.  sys.platform is darwin, so edit
 setupext.py and add '/usr/X11R6' to the basedir dictionary for the
 'darwin' key.  You need to install pkgcong-0.22 from
 http://pkgconfig.freedesktop.org/releases/ (just configure, sudo make
 install it) so that matplotlib can use it to find an properly
 configure png and freetype.  You will need to set the pkgcong path

   export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig

 After all that, I could build mpl from svn with

   python setup.py build
   sudo python setup.py install

 and successfully make a figure with

   ipython -pylab
   plot([1,2,3])

 which used the wxagg backend.

 -
 This SF.net email is sponsored by: Microsoft
 Defy all challenges. Microsoft(R) Visual Studio 2005.