From: James B. <bo...@ll...> - 2006-08-21 23:12:28
|
I am using matplotlib 0.87.3 The documentation of colorbar in color.py seems to indicate that one should be able to create a color bar with pointed ends, the fill color of the ends corresponding to the over and under colors. I have not been able to get this to work. I have set the colormap.set_under and set_over values but no success. If this does work could someone (Eric?) post an example, of how it is done. I feel that I am missing something simple. Thanks for any help. --Jim |
From: Eric F. <ef...@ha...> - 2006-08-22 00:13:27
|
Jim, Look at examples/image_masked.py. I think that is the only example with pointed ends, and I think it was present as-is in 0.87.3. Eric James Boyle wrote: > I am using matplotlib 0.87.3 > > The documentation of colorbar in color.py seems to indicate that one > should be able to create a color bar with pointed ends, the fill color > of the ends corresponding to the over and under colors. > > I have not been able to get this to work. I have set the > colormap.set_under and set_over values but no success. > > If this does work could someone (Eric?) post an example, of how it is > done. I feel that I am missing something simple. > > Thanks for any help. > > --Jim > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: James B. <bo...@ll...> - 2006-08-22 16:54:44
|
Thanks, Eric Ok, I ran the image_masked.py and all went OK BUT if I change line 34 of image_masked.py: im = imshow(Zm, interpolation='bilinear', cmap=palette, norm = colors.normalize(vmin = -1.0, vmax = 1.0, clip = False), origin='lower', extent=[-3,3,-3,3]) to im = contourf(Zm,cmap=palette) I do not get the over/under pointers on the end of the colorbar. Does this feature not work with contourf - Or am I doing something wrong. --Jim On Aug 21, 2006, at 5:13 PM, Eric Firing wrote: > Jim, > > Look at examples/image_masked.py. I think that is the only example > with pointed ends, and I think it was present as-is in 0.87.3. > > Eric > > James Boyle wrote: >> I am using matplotlib 0.87.3 >> The documentation of colorbar in color.py seems to indicate that one >> should be able to create a color bar with pointed ends, the fill >> color of the ends corresponding to the over and under colors. >> I have not been able to get this to work. I have set the >> colormap.set_under and set_over values but no success. >> If this does work could someone (Eric?) post an example, of how it is >> done. I feel that I am missing something simple. >> Thanks for any help. >> --Jim |
From: Philip A. <pa...@eo...> - 2006-08-22 17:06:01
|
James Boyle writes: > Thanks, Eric > > to > > im = contourf(Zm,cmap=palette) > > I do not get the over/under pointers on the end of the colorbar. > > Does this feature not work with contourf - Or am I doing something > wrong. Here's a code segment that works for me: vmin,vmax=(280,305) norm = colors.normalize(vmin = vmin, vmax = vmax, clip = True) cmap=matplotlib.cm.jet cmap.set_over('salmon', 1.0) cmap.set_under('black', 0.25) contplot = axes.contourf(pv.time_value, pv.pressure_value, pv.var1_value, n.arange(vmin,vmax,2.), norm=norm, extend='both', cmap=cmap) I got the hint on this from the contourf docstring ***** New: ***** * 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. To replace clip_ends=True and V = [-100, 2, 1, 0, 1, 2, 100], use extend='both' and V = [2, 1, 0, 1, 2]. regards, Phil |
From: Philip A. <pa...@eo...> - 2006-08-22 17:14:38
|
I was a little suprised to learn that axes.toggle_log_lineary() overwrites user-supplied tick locators and formatters. My naive assumption was that it would "toggle" only the semilog property and leave other attributes unchanged. Perhaps this could be mentioned in the docstring? regards, Phil Austin |
From: Eric F. <ef...@ha...> - 2006-08-22 17:40:36
|
Phil, Jim, Thanks. I need to add a suitable example for the contourf case, because as you have discovered it is a little different from all the other mappable cases: colorbar takes its cue from the contourf arguments so as to be consistent with the way the contourf plot was made. There is a line in the colorbar docstring indicating this, although I don't recall when I put that line in, so it may not be in the version you are using: If mappable is a ContourSet, its extend kwarg is included automatically. Eric Philip Austin wrote: > James Boyle writes: > > Thanks, Eric > > > > to > > > > im = contourf(Zm,cmap=palette) > > > > I do not get the over/under pointers on the end of the colorbar. > > > > Does this feature not work with contourf - Or am I doing something > > wrong. > > Here's a code segment that works for me: > > vmin,vmax=(280,305) > norm = colors.normalize(vmin = vmin, vmax = vmax, clip = True) > cmap=matplotlib.cm.jet > cmap.set_over('salmon', 1.0) > cmap.set_under('black', 0.25) > contplot = axes.contourf(pv.time_value, > pv.pressure_value, > pv.var1_value, > n.arange(vmin,vmax,2.), > norm=norm, > extend='both', > cmap=cmap) > > > I got the hint on this from the contourf docstring > > ***** New: ***** > * 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. > To replace clip_ends=True and V = [-100, 2, 1, 0, 1, 2, 100], > use extend='both' and V = [2, 1, 0, 1, 2]. > > > regards, Phil > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |