Dear Chao,

You could try this,

import matplotlib
import matplotlib.pyplot as plt

# create a color bar with:
sm = plt.cm.ScalarMappable(cmap=plt.get_cmap('Reds'))
sm.set_array(range(10))

# create an horizontal colorbar and put the ticks on the top.
# in your case, you could plot colorbar on top, and tick at 'bottom'
cb = plt.colorbar(sm, orientation='horizontal', location=1.0)
cb.ax.xaxis.set_ticks_position('top')
plt.show()

Another way, you could find useful a function written by Ryan May [0]

Hope that fits.

Arnaldo.

[0]
https://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg07447.html


---
*Arnaldo D'Amaral Pereira Granja Russo*
Lab. de Estudos dos Oceanos e Clima
Instituto de Oceanografia - FURG




2014-03-10 14:39 GMT-03:00 Chao YUE <chaoyue...@gmail.com>:

> Dear all,
>
> I am using the matplotlib 1.2.0 version, is there some way to put the
> label above the horizontal colorbar? like in the attached example, I would
> like the labels to be shown above the colorbar?
>
> thanks a lot in advance,
>
> Cheers,
>
> Chao
>
> --
>
> ***********************************************************************************
> Chao YUE
> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
> UMR 1572 CEA-CNRS-UVSQ
> Batiment 712 - Pe 119
> 91191 GIF Sur YVETTE Cedex
> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
>
> ************************************************************************************
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to