On Sat, Sep 11, 2010 at 2:10 PM, Oz Nahum <nahu...@gmail.com> wrote: > Hi Everyone again, > > So, with the weekend comes some time to think and I found an answer to > another question of mine. > > I know now how to remove xticks in colorbar, and I also know how to > customize the widths of the lines in the color bar. > > import matplotlib > import numpy as np > import matplotlib.cm as cm > import matplotlib.mlab as mlab > import matplotlib.pyplot as plt > from pylab import * > > matplotlib.rcParams['xtick.direction'] = 'out' > matplotlib.rcParams['ytick.direction'] = 'out' > > delta = 0.025 > x = np.arange(-3.0, 3.0, delta) > y = np.arange(-2.0, 2.0, delta) > X, Y = np.meshgrid(x, y) > Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) > Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) > # difference of Gaussians > Z = 10.0 * (Z2 - Z1) > > > > # Create a simple contour plot with labels using default colors. The > # inline argument to clabel will control whether the labels are draw > # over the line segments of the contour, removing the lines beneath > # the label > plt.figure() > CS = plt.contour(X, Y, Z) > plt.clabel(CS, inline=1, fontsize=10,inlinespacing=50) > a=plt.colorbar() > > ticks = a.ax.get_xticklines() > lines = a.ax.get_ygridlines() > children=a.ax.get_children() > > children=a.ax.get_children() > > children[4].set_linewidths([12,12,12,12,12,12]) > > for tick in ticks: > setp(tick, []) > > > plt.title('Customize colorbar') > > > I hope someone finds that useful. And someone is still following my > monologue, my question, how to remove the axes around the colorbar, or at > least changed the to be non-visible, still stands... > > Thanks, > > Oz > > Oz,
I agree, Colorbar isn't the most elegant of objects and is probably due for some improvements. I am sure there is probably a better way to do what you have done, but I am not familiar with it. Anyway, to get rid of the box around the colorbar, the colorbar object has a member attribute called "outline" which you can set_visible(False). a = plt.colorbar() a.outline.set_visible(False) Should do the trick for that part. I hope this helps! Ben Root
------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users