Re: [Matplotlib-users] colorbar+log+latex

2011-01-25 Thread Eric Firing
On 01/25/2011 08:51 PM, Paul Ivanov wrote:
> Eric Firing, on 2011-01-25 19:52,  wrote:
>> On 01/25/2011 06:58 PM, Shrividya Ravi wrote:
>> [...]
>>> On the same topic of the colorbar, how can I readjust the colors such
>>> that it only goes between user-specified values? For example, I have one
>>> imshow plot where the values range between 0 and 350. However, I only
>>> want to look at the values between 300 and 350.
>>
>> z = np.arange(25)
>> z.shape = 5,5
>> imshow(z, vmin=10, vmax=20, interpolation='nearest')
>> colorbar(extend='both')
>>
>> Does that give the desired result?
>
> Hi Shrividya,
>
> Here's how I interpreted what was being asked, in case that
> helps.

(Your interpretation seems like a very strange thing to want to do, but 
maybe you are right.  The OP can inform us.)

>
> Also, Eric, is there a reason we make an outline instead of
> just cbar.ax.set_frame_on? - My manual adjustments screw up and
> confuse whatever data cbar.outline depends on

Yes, we need to make our own outline because a colorbar does not have to 
be a rectangle; it can be pointed at either end or both ends.

Eric


>
> x = np.random.rand(100)
> y = np.random.rand(100)
> z = np.random.rand(100)
> collection = plt.scatter(x, y, c=z*350, vmin=0, vmax=350)
> cbar = plt.colorbar()
> cbar.ax.set_ylim(cbar.norm((300,350)))
> cbar.ax.set_xlim(cbar.norm((300,350))) # maintain aspect ratio
> cbar.set_ticks(np.linspace(300,350,6))
> # didn't see a quick way to fix the outline
> cbar.outline.set_visible(False)
> cbar.ax.set_frame_on(True)
> plt.draw()
>
> best,
>

--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colorbar+log+latex

2011-01-25 Thread Paul Ivanov
Eric Firing, on 2011-01-25 19:52,  wrote:
> On 01/25/2011 06:58 PM, Shrividya Ravi wrote:
> [...]
> > On the same topic of the colorbar, how can I readjust the colors such
> > that it only goes between user-specified values? For example, I have one
> > imshow plot where the values range between 0 and 350. However, I only
> > want to look at the values between 300 and 350.
> 
> z = np.arange(25)
> z.shape = 5,5
> imshow(z, vmin=10, vmax=20, interpolation='nearest')
> colorbar(extend='both')
> 
> Does that give the desired result?

Hi Shrividya,

Here's how I interpreted what was being asked, in case that
helps. 

Also, Eric, is there a reason we make an outline instead of
just cbar.ax.set_frame_on? - My manual adjustments screw up and
confuse whatever data cbar.outline depends on

x = np.random.rand(100)
y = np.random.rand(100)
z = np.random.rand(100)
collection = plt.scatter(x, y, c=z*350, vmin=0, vmax=350)
cbar = plt.colorbar()
cbar.ax.set_ylim(cbar.norm((300,350)))
cbar.ax.set_xlim(cbar.norm((300,350))) # maintain aspect ratio
cbar.set_ticks(np.linspace(300,350,6))
# didn't see a quick way to fix the outline
cbar.outline.set_visible(False) 
cbar.ax.set_frame_on(True)
plt.draw()

best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 


signature.asc
Description: Digital signature
--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colorbar+log+latex

2011-01-25 Thread Eric Firing
On 01/25/2011 06:58 PM, Shrividya Ravi wrote:
[...]
> On the same topic of the colorbar, how can I readjust the colors such
> that it only goes between user-specified values? For example, I have one
> imshow plot where the values range between 0 and 350. However, I only
> want to look at the values between 300 and 350.

z = np.arange(25)
z.shape = 5,5
imshow(z, vmin=10, vmax=20, interpolation='nearest')
colorbar(extend='both')

Does that give the desired result?

Eric

>
> Any help would be greatly appreciated!
>
> Thanks a lot!
> Shrividya

--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colorbar+log+latex

2011-01-25 Thread Shrividya Ravi
Hi there,
I too want a log scale on the colorbar for an imshow plot. I have tried the
solution proposed by Jae-Joon but I cannot get the ticklabels to show. I
have tried to dynamically change the matplotlibrc settings in ipython using
mpl.rc('text',usetex=True) - where mpl = matplotlib. When I run the script I
get a whole series of errors (see in italics below) and the figure doesn't
show.
*
RuntimeError: Could not obtain dvipng version
Exception in Tkinter callback
*
Is there another way to get a colorbar with a log scale?

On the same topic of the colorbar, how can I readjust the colors such that
it only goes between user-specified values? For example, I have one imshow
plot where the values range between 0 and 350. However, I only want to look
at the values between 300 and 350.

Any help would be greatly appreciated!

Thanks a lot!
Shrividya
--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Suggestions for auto scaling fonts , etc for producing images at various scales

2011-01-25 Thread Daryl Herzmann
Hi Paul,

Sorry for the delayed response

On Fri, Jan 21, 2011 at 5:20 PM, Paul Ivanov  wrote:
> ok, much clearer now - what you want is for your text to not be
> cut-off the way it is in the 8x8 80dpi plot? In other words,
> there's not enough space left in the figure for the axis labels
> to be completely displayed.

Even if the text was displayed, it appears to be rather smaller than
it could be.

> At the moment, I don't think there's a simple way of doing it,
> and the quick way I find myself doing is by adjusting the subplot
> parameters using:

Thanks for helping me so much with this.  I'll continue to use my
convert hack until better things come down the pipe.  Sorry that I am
not able to write patches to help this situation. :(

daryl

--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] osx dock weirdness

2011-01-25 Thread Daniel Hyams
(warning, this may not be directly a matplotlib question, but I
thought that someone may have run across this)

I have a colleague with a macbook pro, and I was showing him
matplotlib.  Downloaded an example from the gallery, and ran it.  No
windows showed up, but we did get the little bouncing "python rocket"
on the dock.  Clicking the rocket showed us the plot window, and
everything was fine.  But does anyone know why the plot window just
doesn't show up directly?  So, every time he runs his script to
generate a result and a plot, he has to go click the rocket to be able
to see anything. I have a mac at home, and it doesn't do this as far
as I know.

Using the python.org 2.6.6, all paths set correctly, and matplotlib
1.0.0; both installed from appropriate dmg's from the respective web
sites.

It was just weird, and I thought maybe someone else had run into the same thing.

-- 
Daniel Hyams
dhy...@gmail.com

--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Solution: How to get a Mac OS X version of Tcl/Tk rather than X11 version.

2011-01-25 Thread Lou Pecora
- Original Message 
From: Friedrich Romstedt 
To: Lou Pecora 
Cc: matplotlib-users@lists.sourceforge.net
Sent: Tue, January 25, 2011 7:40:23 AM
Subject: Re: [Matplotlib-users] How to get a Mac OS X version of Tcl/Tk rather 
than X11 version.

2011/1/24 Lou Pecora :
> I have an installation of Python 2.6.4 on my MacBook Pro (OS X 10.6) that by
> default uses X11 windows and dialogs rather than the Mac version of those GUI
> items.  In my googling and exchanges on other support groups I've come down to
> the problem may be with the Tcl/Tk installation using the "generic" X11 GUI
> rather than the Mac version.  Does anyone know how I can change that in the Tk
> part of the python framework?
>
> I think this problem came up in the iPython email list, but I didn't get 
enough
> info from the messages there.
>
> More Info:  The python framework is part of the SAGE package which I installed
> from source.  I did this on my Mac Pro (system 10.4) and it works well with 
Mac
> windows for matplotlib and Mac open/save dialogs for Tk calls.  But on my
> MacBook Pro I get X11 windows and dialogs.  I want the Mac versions.
>
> Even more info:
>
> If you're interested, here's the original message I put up on the SAGE support
> group and was told it's a problem with the type of Tcl/Tk installed.
>
> -- Lou Pecora
[cut]

I have a self-compiled Python 2.6.5 on Mac OS X 10.6.6, with
self-compiled matplotlib.

It shouldn't matter if mpl is self-compiled or not, since the TkAgg
backend just uses the Python Tkinter module.  mpl uses some blitter
extension, but this shouldn't matter here too.

I don't have Sage installed, and I know little about Sage.

My Tkinter widgets, irrespective of mpl or not, have the Aqua look-and-feel.

I know that, using the binary distribution package of Python 2.x I
used before, I got *not real* Aqua look-and-feel, but it wasn't either
X11 iirc (i.e. no X11 spawned; assumed that spawning X11 implies that
is shows up in the Dock).  With that binary, text boxes did not have
Aqua boundaries, but I do not remember precisely how buttons looked
like.  Save dialogs were also not as you might want them to have; with
the self-compiled Python, they are like in any other Mac app.  I
remeber vaguely that the Python binary Mac OS X packages are compiled
agains an older Tcl/Tk, for support of Mac OS X 10.4.  Anyway, all
this is long ago.

I tried this on my system:
n0877:lib-dynload Friedrich$ pwd
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload
n0877:lib-dynload Friedrich$ otool -L _tkinter.so
_tkinter.so:
/System/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl
(compatibility version 8.5.0, current version 8.5.7)
/System/Library/Frameworks/Tk.framework/Versions/8.5/Tk
(compatibility version 8.5.0, current version 8.5.7)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
version 438.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 125.2.0)

It tells you what Tcl/Tk frameworks the Tkinter binary module is linked against.

Be warned that compiling mpl on Mac OS X 10.6 is a bit cumbersome due
to compiler issues.

Friedrich


--

Hi, Friedrich,

You have given me the key to the solution to my problem.  Thank you.  The 
problem was that I had separate Tcl and Tk Frameworks installed and SAGE was 
using those.  The solution is to remove those and re-build SAGE which then is 
smart enough to use the Apple supplied Tcl and Tk Frameworks.  That gives what 
looks like the Aqua interface.  However, it does not add in the Default Folder 
add-on that I have for open and save dialogs.  But I can live without that.  
The 
X11 interface is gone.  Below are instructions for others who might have this 
problem.  Thanks, again.

I ran your otool command on my Apple python installation down in 
 
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload


and got this output:

_tkinter.so:
 /System/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl (compatibility 
version 8.5.0, current version 8.5.7)
 /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk (compatibility 
version 8.5.0, current version 8.5.7)
 /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 
125.2.0)

So my Apple python is under /System not /Library like yours.

When I go to the SAGE folder and run otool on its lib-dynload folder I got

_tkinter.so:
 /Library/Frameworks/Tcl.framework/Versions/8.5/Tcl (compatibility version 
8.5.0, current version 8.5.9)
 /Library/Frameworks/Tk.framework/Versions/8.5/Tk (compatibility version 
8.5.0, current version 8.5.9)
 /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 
125.2.1)

Note, these frameworks are down in the /Library folder which shows SAGE is 
building the Tk library on the Tcl and Tk frameworks I had installed earlier, 
not on the Apple versions down in /System folder.  

These s

Re: [Matplotlib-users] Defining a precise x-axis max in plot()

2011-01-25 Thread Lionel (Lee) Brooks 3rd
Hi Eric,

You solved my problem; I called axis after the call to plot and the 
min-max obeyed my explicit definition.

The version of matplotlib that I am running is "python-matplotlib - 
0.99.0-1ubuntu1 (amd64)".
Sorry for the incomplete code snippet that I submitted with my initial 
request. In the future I will submit working code.
Thank you for your swift response and thanks to all the matplotlib 
developers.

Sincerely,
Lee

> On 01/24/2011 02:49 PM, Lionel (Lee) Brooks 3rd wrote:
>> > Hello Gentlepeople,
>> >
>> > I am plotting an integer array using: matplotlib.pyplot.plot().
>> > For my purposes it is imperative that the x-axis be explicitly defined.
>> > I have tried to achieve this by using: matplotlib.pyplot.axis(v).
>> > Where v is a list of integer values corresponding to the desired axes
>> > limits [xmin, xmax, ymin, ymax].
>> > However, the x-axis that is displayed does not obey my explicit xmax
>> > declaration; the value is rounded up.
>> >
>
>
> I am not seeing the problem when I try what I think is a minimal 
> example; what version of mpl are you using?  And have you tried calling 
> axis after the call to plot?  This might have been necessary in some 
> earlier versions; I don't recall.
>
> (In ipython -pylab, my example was this:
>
> ax1 = gca()
> ax1.axis([0,9.9,0,9.9])
> ax1.plot([1,2])
> draw()
>
> in which no rounding occurs.)
>   
>   



--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] (no subject)

2011-01-25 Thread Uri Laserson
I recently bought a new Macbook Air, with OS X 10.6.  I started using a new
package manager called homebrew (http://mxcl.github.com/homebrew/) which is
simple, clean, and git-based.  I find it incredibly easy to use, and my
numpy/scipy/mpl stack (using repo MPL) installed very smoothly.

The package will build everything from scratch, and it builds python2.7 for
you.

Here is what I did on my new computer.  (NOTE: I had some trouble
replicating this on an older computer, but eventually got it working.  If
this doesn't work for you, let me know, and I'll give you info on the other
install I did with homebrew.)

brew install python

brew install pip

# install gfortran from here:
# http://r.research.att.com/tools/

brew install fftw

brew install suite-sparse

# based on:
http://mail.scipy.org/pipermail/numpy-discussion/2010-August/052227.html
# download numpy 1.5.1
# download scipy 0.8.0
# tarballs
# set the following environment vars:
export MACOSX_DEPLOYMENT_TARGET=10.6
export CFLAGS="-arch i386 -arch x86_64"
export FFLAGS="-m32 -m64"
export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch
x86_64 -framework Accelerate"
# in numpy directory:
python setup.py build --fcompiler=gnu95
python setup.py install
# in scipy directory:
python setup.py build --fcompiler=gnu95
sudo python setup.py install

# fresh shell
pip install ipython


Uri

...
Uri Laserson
Graduate Student, Biomedical Engineering
Harvard-MIT Division of Health Sciences and Technology
M +1 917 742 8019
laser...@mit.edu


On Tue, Jan 25, 2011 at 05:09, Peter Smale  wrote:

> Hi,
> I am using Matplotlib with python 2.6 on a MacBook Pro (Mac OS X 10.6):
>
> Darwin Peters-MacBook-Pro.local 10.6.0 Darwin Kernel Version 10.6.0: Wed
> Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386
>
> I had a hard job getting matplotlib going, but eventually managed it using
> an easy_install script that installed scipy and numpy as well. Matplotlib
> would not work with the EPD distribution on my machine. I also tried
> installing python 2.7 on my mac and working with that but it didn't work
> either. So I deleted all (I hope) the python stuff I had tried to get going,
> including environment variables, keeping just the default python 2.6 that
> comes with Mac OS X 10.6. Now matplotlib works just fine.
>
> But now when I run port selfupdate and then port -v upgrade outdated i get
> the following error:
>
> ...
> --->  Activating python26 @2.6.6_1
> Error: Target org.macports.activate returned: Image error:
> /opt/local/bin/python2.6 already exists and does not belong to a registered
> port.  Unable to activate port python26. Use 'port -f activate python26' to
> force the activation.
> Error: Failed to install python26
> Log for python26 is at:
> /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/main.log
> Error: The following dependencies were not installed: python26
> Error: Unable to upgrade port: 1
> To report a bug, see 
>
> I wonder if this is due to an old failed install that I tried with
> macports.
> My question is: can I force this activation and know that my matplotlib etc
> will still work?
> If this is nothing to do with updating the shipped python, how can I stop
> macports trying to upgrade python 2.6?
>
> I really don't want to do anything that will break my lovely matplotlib
> again.
>
> This might be more of a macports question, but I'm interested to hear of
> others' experiences with matplotlib on mac OS X 10.6 anyway.
>
> Cheers,
> Peter
>
> --
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better
> price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Find the RMS from a PSD

2011-01-25 Thread E
I think this was a bug in the PSD function in matplotlib 0.98.1 (Debian
lenny). This was making me crazy.
I took newer source code of this function from the project and all is
going well.

So to get the RMS power from PSD :

y, x = pylab.psd(data, NFFT = nfft, Fs = samplerate)
freqbandwith = x[1]
y = y*freqbandwith
rms =  scipy.sqrt(y.sum())

It should be the same as :

rms = data**2
rms = scipy.sqrt(rms.sum()/len(data))
--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] zoomed copy of axis for grid of subplots

2011-01-25 Thread johanngoetz

Hello,
A common task I have is to histogram one variable of a multidimensional
dataset as a function of two (or more) variables. I have attached an example
which shows exactly what I would like to do.

The problem I would like to solve is the zoomed in x-axis which is the last
part of the script attached. I start by copying one of the subplots with
Axes.twiny() and proceed to adjust it and label it. The results are quite
nice but as soon as I start adjusting the plotted window or any of the
subplot spacing parameters, this "copy of an axis" does not transform
properly. Could anyone make a suggestion as to which transformations I
should use to shift and zoom the new axes? Or perhaps there is a better
method for drawing a zoomed in version of an axis?

I would like to submit this to the examples/gallery page but feel that these
details need to be addressed, and I am not sure I know how to fix them.
Hopefully, I have commented this example enough that someone could follow
what I am doing.

Thank you,
Johann

http://old.nabble.com/file/p30748088/grid_plot.png 

http://old.nabble.com/file/p30748088/grid_plot.py grid_plot.py 


-- 
View this message in context: 
http://old.nabble.com/zoomed-copy-of-axis-for-grid-of-subplots-tp30748088p30748088.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to get a Mac OS X version of Tcl/Tk rather than X11 version.

2011-01-25 Thread Friedrich Romstedt
2011/1/24 Lou Pecora :
> I have an installation of Python 2.6.4 on my MacBook Pro (OS X 10.6) that by
> default uses X11 windows and dialogs rather than the Mac version of those GUI
> items.  In my googling and exchanges on other support groups I've come down to
> the problem may be with the Tcl/Tk installation using the "generic" X11 GUI
> rather than the Mac version.  Does anyone know how I can change that in the Tk
> part of the python framework?
>
> I think this problem came up in the iPython email list, but I didn't get 
> enough
> info from the messages there.
>
> More Info:  The python framework is part of the SAGE package which I installed
> from source.  I did this on my Mac Pro (system 10.4) and it works well with 
> Mac
> windows for matplotlib and Mac open/save dialogs for Tk calls.  But on my
> MacBook Pro I get X11 windows and dialogs.  I want the Mac versions.
>
> Even more info:
>
> If you're interested, here's the original message I put up on the SAGE support
> group and was told it's a problem with the type of Tcl/Tk installed.
>
> -- Lou Pecora
>
> -
>
> I have an installation of SAGE (from source) on my Mac laptop in which using 
> the
> tcl/tk library to plot (using TKAgg backend) or call tk file open/save dialogs
> calls the X11 versions and not the native Mac versions of dialogs and windows.
> I want to get the Mac versions.
>
> I posted about this on this list recently and now after a response here and 
> much
> googling I have the sense that the problem is that I have a SAGE package with 
> an
> X11 version of the tk library rather than the Mac one. I compiled SAGE from
> source on my Mac laptop. That went perfectly.  I don't know how I got the X11
> version since I also compiled SAGE from source on my Mac desktop where the
> plotting and file dialogs are the correct Mac versions, not X11. The only
> difference is that the laptop is Mac OS X 10.6 and the desktop is 10.4.  If 
> that
> matters, I don't know.
>
> Does anyone know how to get the Mac version installed in the SAGE 
> source-compile
> installation?  I have not found an answer to this elsewhere.  I'm hoping 
> someone
> here knows how this is done with the source installation.

I have a self-compiled Python 2.6.5 on Mac OS X 10.6.6, with
self-compiled matplotlib.

It shouldn't matter if mpl is self-compiled or not, since the TkAgg
backend just uses the Python Tkinter module.  mpl uses some blitter
extension, but this shouldn't matter here too.

I don't have Sage installed, and I know little about Sage.

My Tkinter widgets, irrespective of mpl or not, have the Aqua look-and-feel.

I know that, using the binary distribution package of Python 2.x I
used before, I got *not real* Aqua look-and-feel, but it wasn't either
X11 iirc (i.e. no X11 spawned; assumed that spawning X11 implies that
is shows up in the Dock).  With that binary, text boxes did not have
Aqua boundaries, but I do not remember precisely how buttons looked
like.  Save dialogs were also not as you might want them to have; with
the self-compiled Python, they are like in any other Mac app.  I
remeber vaguely that the Python binary Mac OS X packages are compiled
agains an older Tcl/Tk, for support of Mac OS X 10.4.  Anyway, all
this is long ago.

I tried this on my system:
n0877:lib-dynload Friedrich$ pwd
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload
n0877:lib-dynload Friedrich$ otool -L _tkinter.so
_tkinter.so:
/System/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl
(compatibility version 8.5.0, current version 8.5.7)
/System/Library/Frameworks/Tk.framework/Versions/8.5/Tk
(compatibility version 8.5.0, current version 8.5.7)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
version 438.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 125.2.0)

It tells you what Tcl/Tk frameworks the Tkinter binary module is linked against.

Be warned that compiling mpl on Mac OS X 10.6 is a bit cumbersome due
to compiler issues.

Friedrich

--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] X and Y label position in axes_grid1.AxesGrid/ImageGrid

2011-01-25 Thread Jae-Joon Lee
On Tue, Jan 25, 2011 at 10:43 AM, Russell Hewett  wrote:
> Though, the top and right side are technically on the outside too.  Perhaps
> that should be an available or the default setting?  Perhaps the top row
> should default to labeling on the top, the right column default to labeling
> on the right, etc?
>

As the mode name "L" implies, it means "left" and "bottom" side (of
the whole grid).

Maybe we can have an "outer" mode. Any contribution will be welcomed.

Regards,

-JJ

--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Contoured basemap

2011-01-25 Thread Daniel Fulger
> On Thursday, January 20, 2011, Jeff Whitaker  wrote:
>> On 1/20/11 2:31 PM, R. Mitra wrote:
>>> Hi
>>> ? ? ?I have a set of records with known lat long. ?I want to show the
>>> concentration of the records with a contour diagram on a world map in
>>> any projection. It cannot spill over to the oceans. I know I have to
>>> use basemap. ?Is there a quick recipe somewhere I can follow to give
>>> me a desired output. ?I have gone through earlier posts on this board
>>> but cannot find the right one. ?Any pointers would be very helpful.
>>> Many thanks.
>>> Best
>>> Mitra
>>
>>
>> Mitra: ?The basic procedure is this:
>>
>> 1) load you data into 2d numpy arrays (lats, lons, data). ?lats and lons
>> must be in degrees (not radians).
>> 2) create a Basemap instance (called "map") for the desired projection.
>> 3) calculate the map projection coordinates of your grid with x,y =
>> map(lons,lats)
>> 4) contour your data with the contourf method (map.contourf).
>> 5) draw coastlines with the coastlines method.
>> 6) draw lat/lon lines with the drawparallels and drawmeridians methods.
>>
>> There are many examples of this in the basemap examples directory.
>>
>> -Jeff
>> 
>
>In order to contour, you will need some sort z-value to contour.  This
>means you need to bin your data.  You could use numpy's hist2d, or (I
>prefer) matplotlib's hexbin().
>
>I hope that helps!
>Ben Root


Hi,

its been a while but it might help to make Ben's description more specific 
w.r.t. binning the
data to obtain a z-value array of suitable dimension from irregular data. 
Starting point 
are the following variables:

gmax, gmay: lists (or arrays) of irregular data point coordinates (possibly 
already in the desired projection)
gmaVal: list of respective z-values. 

The following snippet creates a contour line plot with interpolating colours 
between the contour lines:

 SNIPPET:
xi = numpy.linspace(min(gmax),max(gmax),500) 
yi = numpy.linspace(min(gmay),max(gmay),500)
zi = griddata(gmax,gmay,gmaVal,xi,yi,interp='nn')
CS = pyplot.contour (xi,yi,zi,15,colors='grey',linewidths=0.1)
CS = pyplot.contourf(xi,yi,zi,15,cmap=cm.get_cmap("jet"))

The number 500 is arbitrary and should suit your desired resolution.

Look up the function "griddata" in: 
from matplotlib.mlab import griddata
for which you quickly find descriptions in the web under the key words 
"irregularly spaced data".
This is a topic in itself.

In most (non-pathologic) cases it probably makes no differerence whether 
interpolating in projected
coords or in lon-lat.

Regards
Daniel

--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] (no subject)

2011-01-25 Thread Peter Smale
Hi,
I am using Matplotlib with python 2.6 on a MacBook Pro (Mac OS X 10.6):

Darwin Peters-MacBook-Pro.local 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 
18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386

I had a hard job getting matplotlib going, but eventually managed it using an 
easy_install script that installed scipy and numpy as well. Matplotlib would 
not work with the EPD distribution on my machine. I also tried installing 
python 2.7 on my mac and working with that but it didn't work either. So I 
deleted all (I hope) the python stuff I had tried to get going, including 
environment variables, keeping just the default python 2.6 that comes with Mac 
OS X 10.6. Now matplotlib works just fine.

But now when I run port selfupdate and then port -v upgrade outdated i get the 
following error:

...
--->  Activating python26 @2.6.6_1
Error: Target org.macports.activate returned: Image error: 
/opt/local/bin/python2.6 already exists and does not belong to a registered 
port.  Unable to activate port python26. Use 'port -f activate python26' to 
force the activation.
Error: Failed to install python26
Log for python26 is at: 
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/main.log
Error: The following dependencies were not installed: python26
Error: Unable to upgrade port: 1
To report a bug, see 

I wonder if this is due to an old failed install that I tried with macports.
My question is: can I force this activation and know that my matplotlib etc 
will still work?
If this is nothing to do with updating the shipped python, how can I stop 
macports trying to upgrade python 2.6? 

I really don't want to do anything that will break my lovely matplotlib again.

This might be more of a macports question, but I'm interested to hear of 
others' experiences with matplotlib on mac OS X 10.6 anyway.

Cheers,
Peter
--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users