Small change to speed up imshow()

I routinely plot fairly large datasets (~4million points) using imshow but on my machine this takes about 11 secs to complete. I went through the code and made a couple of minor changes where the image data would get clipped by vmax and vmin only if the user supplied a vmax or vmin. The clipping is unnecessary if the user does not supply these values since vmax and vmin default to the max and min in the image. I also replaced two successive where(...) calls with a single clip(...) call and that seems to have helped a tiny bit as well. This change has been tested on 0.80 compiled with Numeric, though I can't envision how this would break anything. The profiler tells me that my plot time has decreased from 11.8 sec to 7.2 sec. Hope this helps.

Scott.

diff colors.py /local/usr/src/matplotlib-0.80/lib/matplotlib/colors.py

34c34
< zeros, asarray, sort, searchsorted, sometrue, ravel, divide, clip

···

---

     zeros, asarray, sort, searchsorted, sometrue, ravel, divide

554,555c554
< needs_clipping = True
<
---

562,563d560
< if vmin is None and vmax is None:
< needs_clipping = False
573,574c570,572
< if needs_clipping:
< val = clip(val,vmin, vmax)
---

            val = where(val<vmin, vmin, val)
            val = where(val>vmax, vmax, val)