First, thanks to you for your answers!
I tried all the solutions and the one with the AxisGrid Toolkit worked out
best for me.

There are only some small questions left.
How do I change the origin and how do I change fontsize of the ticklabels?


#-----------------------------code------------
import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import AxesGrid
import pylab as pyl
matplotlib.rcParams['xtick.direction'] = 'out'
matplotlib.rcParams['ytick.direction'] = 'out'

delta = 0.5
x = np.arange(0, 90.0, delta)
y = np.arange(0, 90.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 16.0, 17.0, 60.0, 60.0)
Z2 = mlab.bivariate_normal(X, Y, 16.5, 23.5, 45, 45)
# difference of Gaussians
Z = 10.0 * (Z2 - Z1)

#plt.figure()

f,(ax,ax2,ax3) = plt.subplots(3,1)
CS = ax.contourf(X, Y, Z)
CS = ax2.contourf(X, Y, Z)
plt.colorbar(CS,cax=ax3,orientation='horizontal')

fig00 = plt.figure(figsize=(10,3.2), dpi=100, facecolor='w', edgecolor='k')
    
grid = AxesGrid(fig00, 111, # similar to subplot(132)
                    nrows_ncols = (1, 2),
                    axes_pad = 0.4,
                    share_all=True,
                    label_mode = "L",
                    cbar_pad = 0.2,
                    cbar_location = "right",
                    cbar_mode="single",
                )
p0 = grid[0].contourf(X, Y, Z,origin='upper')
p20 = grid[1].contourf(X,Y,Z,origin= 'upper')

#-------------not working---------
ylim = pyl.get(plt.gca(), 'ylim')
plt.setp(plt.gca(), ylim=ylim[::-1])#
#---------------------------------------

plt.colorbar(p0, cax = grid.cbar_axes[0])
    

for cax in grid.cbar_axes:
    cax.toggle_label(True)
            
grid[0].set_xticks([0,90,45])
grid[0].set_yticks(pyl.arange(0,100,10))
grid[1].set_xticks([0,90,45])
grid[1].set_yticks(pyl.arange(0,100,10))
grid[0].set_xlabel('phi 1', fontsize=8)
grid[1].set_xlabel('phi 1', fontsize=8)
grid[0].set_ylabel('$\Phi$', fontsize=12)
grid[1].set_ylabel('$\Phi$', fontsize=12)

plt.show()




Siggi
-- 
View this message in context: 
http://old.nabble.com/Decouple-the-colorbar-form-subplot-tp32037832p32117770.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
10 Tips for Better Web Security
Learn 10 ways to better secure your business today. Topics covered include:
Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
security Microsoft Exchange, secure Instant Messaging, and much more.
http://www.accelacomm.com/jaw/sfnl/114/51426210/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to