Hi,

Eric Firing wrote:
>> in a case similar to matplotlib-0.87.7/examples/contour_demo.py 
>> (figure 4), would it be possible to merge to two colorbars (a 
>> continuous one from imshow, a discrete one from contour) into a single 
>> colorbar? Indeed, in that case, the two colorbars are mostly redundant.
> 
> Yes, lines can be superimposed on a continuous colorbar.  The demo is 
> not ideal; I was mainly showing that one could use two colorbars for two 
> different things.  I have changed the contourf_demo.py in svn to include 
> an example of a merged colorbar.  Maybe I will change contour_demo.py 

Thanks! For those of you interested to know whitout having to look at 
SVN repository, you need to use colorbar method add_lines:

X, Y = meshgrid(linspace(-3,3,11),linspace(-3,3,11))
Z = bivariate_normal(X, Y, 1.0, 1.0, 1.0, 1.0)

lev = linspace(Z.min(),Z.max(),11)[1:-1]

im = imshow(Z, extent=[-3,3,-3,3])
cl = contour(X,Y,Z, lev, colors='k')

cb = colorbar(im)
cb.add_lines(cl)

Cheers.
-- 
             /  \     ,    ,
   _._     _ |oo| _  / \__/ \
  _||||   ((/ () \))   /  \      Yannick COPIN  (o:>*  Doctus cum libro
  |||||/|  ( ==== )    |oo|      Institut de physique nucleaire de Lyon
   \____/  _`\  /'_    /  \                            (IN2P3 - France)
   /   /.-' /\<>/\ `\.( () )_._  Tel: (33/0) 472 431 968
   |    `  /  \/  \  /`'--'////) http://snovae.in2p3.fr/ycopin/
    \__,-'`|  |.  |\/ |/\/\|"\"` AIM: YcCopin    ICQ: 236931013
       jgs |  |.  | \___/\___/
           |  |.  |   |    |

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

Reply via email to