James Boyle wrote: > I cannot get the contourf extended color map ranges to show up in the plot. > the extend option of contourf states: > > extend = 'neither', 'both', 'min', 'max' > Unless this is 'neither' (default), contour levels are > automatically added to one or both ends of the range so that > all data are included. These added ranges are then > mapped to the special colormap values which default to > the ends of the colormap range, but can be set via > Colormap.set_under() and Colormap.set_over() methods > > The code at the of this message produces a plot with color bar > extensions that are the end colors of the bone colormap and not red and > green. The colorMap._rgba_over value is red and the colorMap._rgba_under > value is green, but this is not reflected in the plot. > Any idea what I am doing wrong? > I am using matplotlib 0.91.1 > > --Jim
Jim, I agree, this is confusing. I'm not quite sure what to do about it, other than possibly add or modify an example. The problem is that by default, the norm is autoscaling so that your entire data range is within the vmin-to-vmax range, so your contour plot and your colorbar are simply not seeing any out-of-range values. The immediate solution is to use something like the clim function (or the set_clim method of the mappable) to define the range that is to be mapped to the normal colors; anything out of *this* range will then be mapped to the under or over value. See below for a modification to your script that will map the first and last contour layers to your under and over values. This is just an example; it may not be exactly what you want. > > figure() > colorMap = cm.bone > colorMap.set_over('r') > colorMap.set_under('g') > CS = contourf(X, Y, Z, 10,cmap=colorMap,origin=origin, extend = 'both') CS.set_clim(CS.cvalues[1], CS.cvalues[-2]) > cbar = colorbar(CS) > savefig('contourf_demo1') Eric ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users