Hello,
i draw some rectangle (with PolyCollection) on one figure. I'd like to put around (on the right vertical, or at the bottom horizontal) a colormap with the min and max values (as in http://matplotlib.sourceforge.net/examples/pylab_examples/colorbar_tick_labelling_demo.html) Here is a part of my code ... c = collections.PolyCollection(list_rect) c.set_array(liste_colormap) c.set_cmap(cm.hot) fig = plt.figure(figsize=(16, 12)) ax = fig.add_subplot(111) ax.add_collection(c) ax.set_xlim(xorig, xmax) ax.set_ylim(yorig, ymax) ax.set_yticks((ymax/6, (ymax/6)*3, (ymax/6)*5)) ax.set_yticklabels(('Rangee 1', 'Rangee 2','Rangee 3')) plt.title(str(num_semaine)+"-"+str(annee)) cmap=cmap,norm=norm,orientation='horizontal') plt.colorbar(cax=c, ax=ax) plt.plot() plt.savefig("s"+str(num_semaine)+"-"+str(annee)+".png") At the end, there's a message : Traceback (most recent call last): File "/.../graph4.1.2.py", line 260, in <module> plt.colorbar(cax=c, ax=ax) File "/usr/lib/python2.6/dist-packages/matplotlib/pyplot.py", line 1326, in colorbar ret = gcf().colorbar(mappable, cax = cax, ax=ax, **kw) File "/usr/lib/python2.6/dist-packages/matplotlib/figure.py", line 1002, in colorbar cax.hold(True) AttributeError: 'PolyCollection' object has no attribute 'hold' Any idea ?? Thank you. ###################################################################### Jean-Christophe Penalva Centre Informatique National de l'Enseignement Superieur (CINES) Montpellier, FRANCE Tel : 33 4 67 141 414 Fax : 33 4 67 523 763 http://www.cines.fr/ |
------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://www.creativitycat.com
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users