On Tue, Aug 31, 2010 at 9:08 PM, Benjamin Root <ben.r...@ou.edu> wrote:
> Hello, > > I have been working on a couple of interesting concoctions for matplotlib. > The first is a wrapper class called "ThinWrap" that, essentially, provides a > way to create objects that are linked to a given object. These objects can > then be subclassed for some very interesting behaviors. Which leads me to > my ReMap class. > > The ReMap class is designed to be a wrapper around a Colormap object, and > the __call__ function is overloaded so that some other defined function can > modify the rgba values that comes from a call to the original colormap > object. All of this is done without modifying the original colormap. In > addition, a ReMap object can wrap another ReMap object, allowing for > stacking. As an example, I have created a ToGrayscale() ReMap class. > > For your reviewing pleasure, there are two patch files. The first, > thinwrap.patch, adds the ThinWrap class to cbook.py. The second, > remap.patch, creates a new file "remap.py" that holds the ReMap class and > the ToGrayscale class. In addition, in order for things to work, a few > changes had to be made to other code: > > cm.py: get_cmap() could finish the function without returning anything. I > modified it to remove the "isinstance" check that would cause > non-Colormap/non-string objects to fall into a black hole. We are gonna > have to follow duck-typing here... > colors.py: The Colormap class needs to be a new-style class for ReMap to > work properly > contour.py: Commented out code that did a isinstance() check on the cmap > that would cause ReMaps on contours to fail. > > I have also included an example script to demonstrate how this wrapper > class works and the ToGrayscale() class works. > > Let me know what you think! > Ben Root > Just reping-ing this. I haven't heard anything negative and got a few positive comments off-list. I haven't committed this yet because I am concerned about the implications of my changes to cm.py, colors.py and contour.py. However, if I don't hear any concerns over the next couple of days, shall I assume that it is ok to go ahead and commit? 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-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel