From: Ryan M. <rm...@gm...> - 2008-06-19 01:26:34
|
Yves Revaz wrote: > Hi all, > > When I use: > > colorbar(orientation='horizontal') > > the color bar is drawn on the bottom of the corresponding graph. > Which option will draw the colorbar on the top of the graph ? I think (correct me if I'm wrong devs) you'll have to use the cax keyword argument to manually specifiy the position of the axes in which to draw the colorbar. You'll also need to adjust the position of the plot using figure.subplots_adjust. Like this maybe: import numpy as np import matplotlib.pyplot as plt data = np.random.randn(30,30) plt.pcolor(data) fig = plt.gcf() fig.subplots_adjust(top=0.85) ax = fig.add_axes([0.12, 0.9, 0.8, 0.05]) plt.colorbar(cax=ax, orientation='horizontal') Hope this helps, Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma |