Re: [Matplotlib-users] colorbar() and plt.title()

2010-04-03 Thread Marius 't Hart
Try this:

from pylab import *
from numpy import *

Z = random.randn(100,100)

figure()
subplot(1,2,1)
imgHandle = imshow(Z, cmap=cm.gray)
scatter(random.rand(10)*100,random.rand(10)*100)
colorbar(imgHandle)
title('Hello')
show()

By the way, I find jet a bad colormap to represent scientific data: it 
suggests bands in the data that aren't there and when reduced to 
luminance (eg. students printing/copying in black/white or in the eyes 
of all your colorblind colleagues) the two halves of the scale are 
identical, rendering all graphs completely ambiguous. ;)


Claus wrote:
 Hi,
 I've got two questions: 
 1) one is related to colorbar() on multiple subfigures (see code example 
 below): how do I add a scatterplot if I wanted multiple subfigures? Or, what 
 am I doing wrong in the second code example
 2) in either of the examples, how can I increase the distance between the top 
 of the plot (imshow) and the bottom of the title?


 # code example 1: this works
 fig = plt.figure()
 plt.title('Hello')
 plt.imshow(interpolValsRas, cmap=cm.jet, interpolation='nearest', origin = 
 'lower', extent=[5,95,5,95]) # , 
 plt.scatter(measurementLoc[:,0], measurementLoc[:,1], 10, messwerte, 
 cmap=cm.jet)
 plt.colorbar();


 # code example 2: this works generally, but only if the second last line is 
 commented out
 # Q: how do I add a scatterplot if I wanted multiple subfigures?
 fig = plt.figure()
 ax = fig.add_subplot(111)
 plt.title('Hello')
 ax.imshow(interpolValsRas, cmap=cm.jet, interpolation='nearest', origin = 
 'lower', extent=[5,95,5,95]) # , 
 ax.scatter(measurementLoc[:,0], measurementLoc[:,1], 10, messwerte, 
 cmap=cm.jet)
 # plt.colorbar();
 plt.show()

 Thanks for your help,
 Claus
 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Closing a pyplot window under MSWindows and under Linux

2010-04-03 Thread Enzo Michelangeli
Dear all,

Consider the following short program:

from matplotlib.pyplot import title, show
for i in xrange(3):
title(i+1)
print window No. +str(i+1)+ was closed
show()

If I run it under Windows XP, at each show() the program displays a window and
blocks; if I close the window by clicking on the X at the top right corner,
the program prints the message window No. ... was closed , then opens a new
window, and so on for a total of three iterations.

If I run it under Linux (Ubuntu 9.10, living inside a Virtualbox machine),
everything works the same until I close the first window, after which no new
windows are ever opened and displayed. The program does not die, because all
three messages are sent to console:

window No. 1 was closed
window No. 2 was closed
window No. 3 was closed

My questions for the cognoscenti are:

1. Why this difference?
2. How can I get under Linux the same behaviour as under Windows?

Thanks in advance,

Enzo


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] cmap in eclipse

2010-04-03 Thread David Forel
Hello -

I am using matplotlib in eclipse. For 3D plot test, I am using:

from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
ax = Axes3D(fig)
X = np.arange(-5, 5, 0.25)
Y = np.arange(-5, 5, 0.25)
X, Y = np.meshgrid(X, Y)
R = np.sqrt(X**2 + Y**2)
Z = np.sin(R)
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)

plt.show()

This script works fine outside of Eclipse; that is, just by running
python testplot1.py
but Eclipse says undefined import from variable: jet
The following are my script's header lines:

from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import numpy as np
import matplotlib.pyplot as plt

Suggestions are appreciated.
Regards, David


  

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] griddata and masked arrays

2010-04-03 Thread ms
Hi,

I am trying to use griddata to plot some (irregularly) spaced data as a
contour plot, but sometimes ALL the grid it outputs is masked: so no plot.

In the docs I read:
A masked array is returned if any grid points are outside convex hull
defined by input data (no extrapolation is done).

but I have no real idea of what does it mean.
Any suggestion to troubleshoot / understand what's going on?

Thanks!

m.

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] a quick way to plot 3D surface with point coordination?

2010-04-03 Thread Friedrich Romstedt
I think it should be possible to do unsorted scatter plot, so you can
avoid the second loop.  Maybe the current source doesn't allow for,
but it's certainly possible (hu, I'm not that aquainted with current
z-sorting code, so maybe I'm wrong?) It may be that current z-sorting
uses the mesh grid.

One point caught my attention:  Maybe use sets, or check in loop 1 if
you do not duplicate x or y data?

Do you mask the mesh points not used?

Friedrich

P.S.: And make shure to select Answer to all :-)

2010/4/2 ericyosho ericyo...@gmail.com:
 Thanks, Friendrich,

 So the only problem narrows down to whether I've got to loop through
 the dict to form all the arrays, or there might be some way to define
 a formatter, so that when I apply this formatter on to the
 dictionary, it splits the data into arrays properly.

 Zhe Yao


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Cmap creation

2010-04-03 Thread Friedrich Romstedt
Oh, sorry, it was late at night, and so on, but in fact you said it's
a standard example, so well ... I was wrong.

Friedrich

2010/4/1 Friedrich Romstedt friedrichromst...@gmail.com:
 You forgot about the attachment?

 Friedrich


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] a quick way to plot 3D surface with point coordination?

2010-04-03 Thread ericyosho
Year, I think we could do unsorted scatter plot as well, however I'm
still not satisfied with the book tracking routines I have to check
when doing the surface plotting.

Anyway, thanks, man. You saved a lot.

Hope this time, it CC to the mailing list as well. :-)

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Closing a pyplot window under MSWind ows and under Linux

2010-04-03 Thread Enzo Michelangeli
OK, I found the answer myself. It appears that multiple calls to show() are at
the moment officially unsupported, although they do work for some backends on
some platforms (see e.g.
http://matplotlib.sourceforge.net/faq/howto_faq.html#use-show ). In particular,
I have found that: 

- With Qt4Agg they work under Windows (where Qt4Agg is the default backend, at
least in the Python(X,Y) distribution) but under Linux they result in an
Underlying C/C++ object has been deleted error at line 64 of backend_qt4.py

- With TkAgg they fail silently under Linux (where TkAgg is the default backend,
and under Windows they cause a Fatal Python error: PyEval_RestoreThread: NULL
tstate exception

- with GTKAgg, not available in my Windows installation, they work well under
Linux, apart from a deprecation warning on the use of GTK.Tooltips() instead of
the new GTK.Tooltip()

Considering that multiple show() functionality is important for many users (see
e.g.
http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg13099.html
) I'd like to ask the backend developers to try their best and support this
feature on as many platforms as possible.

Enzo


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Closing a pyplot window under MSWindows and under Linux

2010-04-03 Thread Alan G Isaac
On 4/3/2010 11:19 PM, Enzo Michelangeli wrote:
 multiple show() functionality is important for many users (see
 e.g.
 http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg13099.html


http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.ion

hth,
Alan Isaac


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users