[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


Re: [Matplotlib-users] Cannot build matplot on OS X: libfreetype.dylib and libiconv.2.dylib are not of the right architecture

2009-07-16 Thread Michael Lerner
Hi all,

I tried this again with a clean checkout from svn:

svn co
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlibmatplotlib
(checks out revision 7262)
cd matplotlib/release/osx/
unset PKG_CONFIG_PATH
make fetch_deps
cd bdist_mpkg-0.4.3
sudo python setup.py install
cd ..
make dependencies
cd ../..
python setup.py sdist
mv dist/matplotlib-0.98.6svn.tar.gz release/osx/
cd release/osx



make installers

and it fails. Here are the last couple of lines:

g++ -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g
-L/usr/local/lib -L/Library/Frameworks/Python.framework/Versions/4.3.0/lib
-bundle -undefined dynamic_lookup -arch ppc -arch i386
-L/Users/mglerner/src/matplotlib/release/osx/zlib-1.2.3
-L/Users/mglerner/src/matplotlib/release/osx/libpng-1.2.33
-L/Users/mglerner/src/matplotlib/release/osx/freetype-2.3.7 -Os -arch ppc
-arch i386 -I/Users/mglerner/src/matplotlib/release/osx/zlib-1.2.3
-I/Users/mglerner/src/matplotlib/release/osx/libpng-1.2.33
-I/Users/mglerner/src/matplotlib/release/osx/freetype-2.3.7/include
build/temp.macosx-10.3-fat-2.5/src/ft2font.o
build/temp.macosx-10.3-fat-2.5/src/mplutils.o
build/temp.macosx-10.3-fat-2.5/CXX/cxx_extensions.o
build/temp.macosx-10.3-fat-2.5/CXX/cxxsupport.o
build/temp.macosx-10.3-fat-2.5/CXX/IndirectPythonInterface.o
build/temp.macosx-10.3-fat-2.5/CXX/cxxextensions.o -L/usr/local/lib
-L/usr/lib -L/usr/X11R6/lib -lfreetype -lz -lstdc++ -lm -o
build/lib.macosx-10.3-fat-2.5/matplotlib/ft2font.so
ld warning: in
/Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks/Python.framework/Versions/4.3.0/lib/libz.dylib,
file is not of required architecture
ld warning: in
/Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.10.4.dylib, missing
required architecture ppc in file
ld: in
/Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks/Python.framework/Versions/4.3.0/lib/libz.1.dylib,
file is not of required architecture for architecture ppc
collect2: ld returned 1 exit status
lipo: can't open input file:
/var/folders/mr/mrDdnQgUEQWRcRe-wF1uFE+++TI/-Tmp-//ccAjnLEy.out (No such
file or directory)
error: command 'g++' failed with exit status 1
make: *** [installers] Error 1
laptop-36:osx mglerner$

as I mentioned before, I'm not intimately familiar with the OS X build
process, but I'd be happy to provide additional information/testing.

Thanks,

-michael

On Sat, Jul 11, 2009 at 4:31 PM, Michael Lerner  wrote:

>
>
> On Sat, Jul 11, 2009 at 9:05 AM, John Hunter  wrote:
>
>>
>> It looks like there is an incompatibility with the freetype supplied
>> in /sw (probably fink supplied).  Perhaps it is not configured as a
>> universal binary.
>>
>> You can build mpl from svn the way we do when we make a release, which
>> will automatically fetch and build the dependencies correctly.  First
>> see,
>>
>>
>> http://matplotlib.sourceforge.net/faq/installing_faq.html#which-python-for-osx
>>
>> then grab a copy of mpl from svn
>>
>>  http://matplotlib.sourceforge.net/faq/installing_faq.html#install-svn
>>
>> and cd into the releases/osx directory and follow the instructions in
>> the README there.
>>
>
> Hi,
>
> I get the same errors when I follow those instructions. I have a very new
> 17" MacBook Pro running 10.5.7. I've installed the Enthought Python
> Distribution. These commands worked correctly:
>
> unset PKG_CONFIG_PATH
> make fetch_deps
> cd bdist_mpkg-0.4.3
> sudo python setup.py install
> cd ..
> make dependencies
> cd ../..
> python setup.py sdist
> mv dist/matplotlib-0.98.6svn.tar.gz release/osx/
> cd release/osx
>
> I then edit the Makefile and change
>
> MPLVERSION=0.98.5.3
>
> to
>
> MPLVERSION=0.98.6svn
>
> but the next command,
>
> make installers
>
> produces the error:
>
> ... < blah blah untarring > ...
>
> 
> BUILDING MATPLOTLIB
> matplotlib: 0.98.6svn
> python: 2.5.4 |EPD_Py25 4.3.0| (r254:67916, May 17 2009,
> 20:07:12)  [GCC 4.0.1 (Apple Computer, Inc. build
> 5370)]
>   platform: darwin
>
> REQUIRED DEPENDENCIES
>  numpy: 1.3.0
>  freetype2: found, but unknown version (no pkg-config)
>
> OPTIONAL BACKEND DEPENDENCIES
> libpng: found, but unknown version (no pkg-config)
>Tkinter: Tkinter: 67737, Tk: 8.4, Tcl: 8.4
>   wxPython: 2.8.7.1
> * WxAgg extension not required for wxPython >= 2.8
>   Gtk+: no
> * Building for Gtk+ requires pygtk; you must be
> able
>

Re: [Matplotlib-users] Cannot build matplot on OS X: libfreetype.dylib and libiconv.2.dylib are not of the right architecture

2009-07-11 Thread Michael Lerner
2.5/CXX/cxxsupport.o
build/temp.macosx-10.3-fat-2.5/CXX/IndirectPythonInterface.o
build/temp.macosx-10.3-fat-2.5/CXX/cxxextensions.o -L/usr/local/lib
-L/usr/lib -L/usr/X11R6/lib -lfreetype -lz -lstdc++ -lm -o
build/lib.macosx-10.3-fat-2.5/matplotlib/ft2font.so
ld warning: in
/Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks/Python.framework/Versions/4.3.0/lib/libz.dylib,
file is not of required architecture
ld warning: in
/Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.10.4.dylib, missing
required architecture ppc in file
ld: in
/Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks/Python.framework/Versions/4.3.0/lib/libz.1.dylib,
file is not of required architecture for architecture ppc
collect2: ld returned 1 exit status
lipo: can't open input file:
/var/folders/mr/mrDdnQgUEQWRcRe-wF1uFE+++TI/-Tmp-//ccvdMAI3.out (No such
file or directory)
error: command 'g++' failed with exit status 1
make: *** [installers] Error 1


It appears that I have no idea how the OS X build system works, because I'm
quite surprised by all of the seeming references to 10.3 and 10.4, given
that I'm running 10.5.

I'd be quite happy to provide further information. I'm happy with the stock
matplotlib on my system, but I'd like to get this working so I can submit my
tiny patch to acorr/xcorr.

Thanks,

-michael


> JDH
>
>
> --
> 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
>



-- 
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)
--
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] a tiny addition to acorr

2009-07-10 Thread Michael Lerner
Hi,

I was looking at the autocorrelation of a time series recently and it was
useful to scale the x-axis (i.e. multiply lags by the timestep of my actual
data). It's a trivial change, but it might be useful for others. Here's a
standalone version of axes.acorr:

def scaledacorr(x, stepsize=1, normed=False, detrend=mlab.detrend_none,
usevlines=False, maxlags=None, **kwargs):

import numpy as np
x = detrend(np.asarray(x))
Nx = len(x)
y = x

c = np.correlate(x, y, mode=2)

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

if maxlags is None: maxlags = Nx - 1

if maxlags >= Nx or maxlags < 1:
raise ValueError('maglags must be None or strictly '
 'positive < %d'%Nx)

lags = np.arange(-maxlags,maxlags+1) * stepsize
c = c[Nx-1-maxlags:Nx+maxlags]

if usevlines:
a = vlines(lags, [0], c, **kwargs)
b = axhline(**kwargs)
else:

kwargs.setdefault('marker', 'o')
kwargs.setdefault('linestyle', 'None')
    a, = plot(lags, c, **kwargs)
b = None

return lags, c, a, b


-- 
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)
--
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


Re: [Matplotlib-users] Does anyone have an updated version of SentinelMap?

2008-10-14 Thread Michael Lerner
On Mon, Oct 13, 2008 at 3:59 PM, Eric Firing <[EMAIL PROTECTED]> wrote:
> Michael Lerner wrote:
>>
>> Hi,
>>
>> I'm trying to plot some data where certain values are marked by a
>> sentinel, as per the Cookbook example:
>>
>>
>> http://www.scipy.org/Cookbook/Matplotlib/Plotting_Images_with_Special_Values
>>
>> However, that code is fairly old, and doesn't work. A version that
>> worked as of ~18 months ago was posted to the list:
>>
>> http://www.nabble.com/Re:-Trying-p8831162.html
>>
>> but it fails when I try to use it with matplotlib 0.98.3 and imshow.
>> Does anyone have an updated version?
>>
>> Thanks,
>>
>> -michael
>>
>
> Michael,
>
> In the mpl "examples" directory there is a script that might be directly
> relevant:
>
> examples/pylab_examples/image_masked.py

That's fantastic. I had tried using masked arrays before. They weren't
good enough because I need three different sentinels, and at least one
with a controllable alpha value. The combination of set_over,
set_under and set_bad gives me exactly what I need. Thanks!

-michael

>
> Eric
>



-- 
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)
http://www.umich.edu/~mlerner

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


[Matplotlib-users] Does anyone have an updated version of SentinelMap?

2008-10-13 Thread Michael Lerner
Hi,

I'm trying to plot some data where certain values are marked by a
sentinel, as per the Cookbook example:

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

However, that code is fairly old, and doesn't work. A version that
worked as of ~18 months ago was posted to the list:

http://www.nabble.com/Re:-Trying-p8831162.html

but it fails when I try to use it with matplotlib 0.98.3 and imshow.
Does anyone have an updated version?

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)
http://www.umich.edu/~mlerner

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


[Matplotlib-users] How to highlight part of a matrix (or wash out the rest of it)

2007-04-25 Thread Michael Lerner
Hi,

I have a square matrix that I'm plotting with pcolormesh.  I want to
highlight certain parts of it.  For instance, I might want to
highlight rows and columns 4-20 and 67-80.  I can get the opposite of
what I want by doing something like

pylab.axvspan(4,20,fc='white',lw=0.,alpha=0.15)
pylab.axvspan(67,80,fc='white',lw=0.,alpha=0.15)
pylab.axhspan(4,20,fc='white',lw=0.,alpha=0.15)
pylab.axhspan(67,80,fc='white',lw=0.,alpha=0.15)

but that makes it look like the regions I want to highlight are washed
out.  I'd like the inverse, where I wash out everything else.  How can
I do this?

My first thought was that I might be able to do something with a mask,
where I could plot the data once, then plot it again with a
semitransparent white mask over the parts I didn't want to highlight.

Here's some sample code where I tried to do that (this time masking
out some easy-to-calculate part of the matrix):

#!/usr/bin/env python
import pylab as P
import numpy as N

plotter = P.pcolormesh
plotterargs = {P.imshow:{'interpolation':'nearest','origin':'lower'},
   P.pcolormesh:{}}

n = 10
data = N.zeros((n,n))
for i in range(n):
for j in range(n):
data[i,j] = i*j
plotter(data,vmin=0,vmax=n*n,**plotterargs[plotter])

cmap = P.cm.jet
cmap.set_bad('white',alpha=0.5)
mask = data < 16
data = N.ma.masked_where(mask,data)
plotter(data,cmap=cmap,vmin=0,vmax=n*n,**plotterargs[plotter])
P.show()



If you run it, you'll see that the masked part just ends up grey.
However, if you set plotter to P.imshow, it looks like it pretty much
does what I want.  So, I think I might be close to the answer.  Can
someone help me figure it out?

Thanks,

-michael

-- 
Biophysics Graduate Student
Carlson Lab, University of Michigan
http://www.umich.edu/~mlerner http://lernerclan.net
http://www.umich.edu/~mlerner http://lernerclan.net

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] making subplots with rows different sizes

2007-04-24 Thread Michael Lerner
I recently attended a fantastic workshop by John Hunter and Fernando
Perez, and John pointed out that I really do want to play with the
axis objects directly.  In case someone googles for this later on,
here's how to do it for two boxes:

ax = axes([0.1, 0.3, 0.8, 0.6])
plot(rand(12))

a2 = axes([0.1, 0.1, 0.8, 0.15])
plot(rand(12))

On 3/21/07, Eric Firing <[EMAIL PROTECTED]> wrote:
> John Hunter wrote:
> > On 3/21/07, Michael Lerner <[EMAIL PROTECTED]> wrote:
> >> Hi,
> >>
> >> I want to make a figure that has three subplots.  The top one should
> >> be a big, mostly square thing.  The bottom two should be rectangular
> >> things.  That is, I want it to look like this:
> >>
> >> X
> >> X
> >> X
> >> X
> >>
> >> X
> >> X
> >>
> >> X
> >> X
> >>
> >> so, I'm using subplot(311), subplot(312), subplot(313).  But, things
> >> are getting resized so that each of the rows has the same height.
> >> That really messes up the aspect ratio for my top row.
> >
> > The following might hrlp:
> >
> > ax1 = subplot(211)
> > ax2 = subplot(413)
> > ax3 = subplot(414)
> >
> > JDH
>
> And if you want to tweak the positions you can use, e.g.,  oldpos =
> ax1.get_position() to find out the present position, and
> ax1.set_position(newpos) to change it.  The position rectangles are
> [left, bottom, width, height] in relative coordinates--that is,
> fractions of the figure width and height.
>
> If you want to control the aspect ratio of the data without changing the
> position rectangle (e.g. after adjusting it as above), use
> ax1.set_aspect(aspect, adjustable='datalim').
>
> Eric
>


-- 
Biophysics Graduate Student
Carlson Lab, University of Michigan
http://www.umich.edu/~mlerner http://lernerclan.net

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How can I explicitly set the minor tick locations?

2007-04-23 Thread Michael Lerner
Hi,

I'm plotting an array, stored as 'data'.  It starts out as just the
data, but I add little strips on the left and bottom to highlight
certain ranges (black where I want the highlights and white where I
don't).  I use concatenate to tack those strips onto my data array, so
'data' ends up bigger than it should be.  I then want the ticks and
labels to ignore the strips.

I can set the major ticks explicitly like this:

pylab.xticks(mlab.linspace(offset,data.shape[0],num_major_ticks)

But I didn't see an obvious way to set the minor ticks explicitly.  I
made a fragile locator class like this::

class ExplicitLinearLocator(Locator):
def __init__(self,vmin,vmax,numticks):
self.vmin = vmin
self.vmax = vmax
self.numticks=numticks
def __call__(self):
return mlab.linspace(self.vmin,self.vmax,self.numticks)

But it seems like I should either beef that up or just set the minor
ticks explicitly.  How do I do that?

Thanks,

-michael

-- 
Biophysics Graduate Student
Carlson Lab, University of Michigan
http://www.umich.edu/~mlerner http://lernerclan.net

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] making subplots with rows different sizes

2007-03-21 Thread Michael Lerner
Hi,

Sorry if I'm just being thick .. I read through several of the
examples, and didn't figure it out.  I can figure out how to use
figsize to set the size of the entire figure, but I want several
subplots on one figure.  Maybe you can help me fix some sample code.
This plots a matrix and sqrt(x)/2.  I'd like to have the matrix show
up as a square while sqrt(x)/2 shows up as a rectangle.  The call to
axis('scaled') makes my matrix show up as square, but I'd like it to
be stretched out so that it uses up all of the horizontal space and
makes the figure taller.  That is, I want row 1 to be taller than row
2.

Thanks,

-Michael

#!/usr/bin/env python

from pylab import *
subplot(211)
mat = array([[1,2,3],[4,5,6],[7,8,9]])
pcolormesh(mat)
axis('scaled')

subplot(212)
dt = 0.001
t = arange(0.0, 10.0, dt)
root_t_over_2 = (t/2.0)**0.5
plot(t,root_t_over_2)

show()


On 3/21/07, Zack <[EMAIL PROTECTED]> wrote:
> Hi Michael,
>
> On 21 March 2007, Michael Lerner wrote:
>
> > so, I'm using subplot(311), subplot(312), subplot(313).  But, things
> > are getting resized so that each of the rows has the same height.
> > That really messes up the aspect ratio for my top row.
> >
> > I tried axis('equal') and axis('scaled') after making the first
> > subplot.  I do indeed get a good aspect ratio, but it shrinks things
> > to do this, rather than stretching things.  I'd really like the top
> > row to be taller than the bottom rows.  How can I do this?
>
> See the examples.
>
> You just have to set figure size you need.
>
> f = Figure(figsize=(5,4), dpi=100)
>
> --
> Zack
>
> -
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


-- 
Biophysics Graduate Student
Carlson Lab, University of Michigan
http://www.umich.edu/~mlerner http://lernerclan.net

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


[Matplotlib-users] making subplots with rows different sizes

2007-03-21 Thread Michael Lerner
Hi,

I want to make a figure that has three subplots.  The top one should
be a big, mostly square thing.  The bottom two should be rectangular
things.  That is, I want it to look like this:

X
X
X
X

X
X

X
X

so, I'm using subplot(311), subplot(312), subplot(313).  But, things
are getting resized so that each of the rows has the same height.
That really messes up the aspect ratio for my top row.

I tried axis('equal') and axis('scaled') after making the first
subplot.  I do indeed get a good aspect ratio, but it shrinks things
to do this, rather than stretching things.  I'd really like the top
row to be taller than the bottom rows.  How can I do this?

If it matters, I make the top box with pcolormesh and the bottom
rectangles with plot.

Thank you,

-michael

-- 
Biophysics Graduate Student
Carlson Lab, University of Michigan
http://www.umich.edu/~mlerner http://lernerclan.net

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


Re: [Matplotlib-users] Trying

2007-02-07 Thread Michael Lerner
That works for me.  Thanks.  I was trying to muck around with _lut
directly and make a sentinel version of LinearSegmentedColormap.  As I
didn't really know what I was doing, I was having some strange
results.  Also, in case other folks don't realize this, you can
initialize this with a Colormap, LinearSegmentedColormap,  etc.

I'd be happy to update the SciPy wiki.  Is it customary to give credit
to various authors (obviously George Nurser and the original author,
not me) in the doc strings, wiki text or what?

Thanks,

-michael

On 2/6/07, George Nurser <[EMAIL PROTECTED]> wrote:
> On 05/02/07, John Hunter <[EMAIL PROTECTED]> wrote:
> > On 2/5/07, Michael Lerner <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > I have some data where I'd like almost all of it to be plotted with a
> > > LinearSegmentedColormap that I've made, but I have a few special
> > > values that I'd like to set to specific colors (white, in this case).
> > > So, I made a LinearSegmentedColormap that works pretty well, but I'm
> > > having trouble with the rest.  I found a nice-looking example at
> > >
> > > http://www.scipy.org/Cookbook/Matplotlib/Plotting_Images_with_Special_Values
> > >
> > > But, it doesn't work for me.  In particular, it complains a lot about
> > > _lut.  I'm using matplotlib 0.87.7 on an intel Mac running OS X and
> > > python 2.4.
> >
> > On a very quick read, it appears that the sentinel map in that example
> > forgot to initialize the baseclass.  Eg, you need
> >
> >  class SentinelMap(Colormap):
> >  def __init__(self, cmap, sentinels={}):
> >  Colormap.__init__(self)  # init the base class
> >  # boilerplate stuff - rest of init function here
> >
> > See if that helps, and let us know.  If you get it working, please fix
> > the wiki (you may have to sign up) and post your example along with
> > it.
> >
> > Otherwise, please post a complete code example and we'll see what we can do.
> >
> > JDH
> >
> >
> > >
> > > Can someone show me how to make a sentinel'd version of a
> > > LinearSegmentedColormap?
> > >
> > > Thank you,
> > >
> > > -Michael Lerner
>
> I had the same problem that you did with the sentinels.py.
>
> I modified the code so that it did work, and attach it here. you can
> test it by running it.  It only works with numpy, because it uses
> fancy indexing. I'm pretty sure it's not done the fastest  way.
>
> You first make up the colormap instance for the real data, without any
> sentinels.
> then use the colormap instance as an argument to the sentinel
> colormap. This is why it
> doesn't do a  Colormap.__init__(self). Not sure that's really best,
> but i just followed the original method.
>
> HTH. George Nurser.
>
>


-- 
Biophysics Graduate Student
Carlson Lab, University of Michigan
http://www.umich.edu/~mlerner http://lernerclan.net

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


[Matplotlib-users] Trying

2007-02-05 Thread Michael Lerner
Hi,

I have some data where I'd like almost all of it to be plotted with a
LinearSegmentedColormap that I've made, but I have a few special
values that I'd like to set to specific colors (white, in this case).
So, I made a LinearSegmentedColormap that works pretty well, but I'm
having trouble with the rest.  I found a nice-looking example at

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

But, it doesn't work for me.  In particular, it complains a lot about
_lut.  I'm using matplotlib 0.87.7 on an intel Mac running OS X and
python 2.4.

Can someone show me how to make a sentinel'd version of a
LinearSegmentedColormap?

Thank you,

-Michael Lerner

-- 
Biophysics Graduate Student
Carlson Lab, University of Michigan
http://www.umich.edu/~mlerner http://lernerclan.net

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