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

Reply via email to