Revision: 8948
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8948&view=rev
Author: efiring
Date: 2011-02-06 00:43:54 +0000 (Sun, 06 Feb 2011)
Log Message:
-----------
image: more conversion to use rgba bytes, other minor cleanup
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/toggle_images.py
trunk/matplotlib/lib/matplotlib/image.py
Modified: trunk/matplotlib/examples/pylab_examples/toggle_images.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/toggle_images.py 2011-02-05
21:57:21 UTC (rev 8947)
+++ trunk/matplotlib/examples/pylab_examples/toggle_images.py 2011-02-06
00:43:54 UTC (rev 8948)
@@ -5,7 +5,7 @@
them to the same axes with hold "on". Then, toggle the visible property of
them using keypress event handling
-If you want two images with sifferent shapes to be plotted with the same
+If you want two images with different shapes to be plotted with the same
extent, they must have the same "extent" property
As usual, we'll define some random images for demo. Real data is much more
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py 2011-02-05 21:57:21 UTC (rev
8947)
+++ trunk/matplotlib/lib/matplotlib/image.py 2011-02-06 00:43:54 UTC (rev
8948)
@@ -654,7 +654,8 @@
def __init__(self, ax, **kwargs):
"""
kwargs are identical to those for AxesImage, except
- that 'interpolation' defaults to 'nearest'
+ that 'interpolation' defaults to 'nearest', and 'bilinear'
+ is the only alternative.
"""
interp = kwargs.pop('interpolation', 'nearest')
AxesImage.__init__(self, ax,
@@ -712,7 +713,7 @@
A.shape = A.shape[0:2]
if len(A.shape) == 2:
if A.dtype != np.uint8:
- A = (self.cmap(self.norm(A))*255).astype(np.uint8)
+ A = self.to_rgba(A, alpha=self._alpha, bytes=True)
self.is_grayscale = self.cmap.is_gray()
else:
A = np.repeat(A[:,:,np.newaxis], 4, 2)
@@ -956,7 +957,7 @@
if self._A is None:
raise RuntimeError('You must first set the image array')
- x = self.to_rgba(self._A, self._alpha)
+ x = self.to_rgba(self._A, self._alpha, bytes=True)
self.magnification = magnification
# if magnification is not one, we need to resize
ismag = magnification!=1
@@ -965,7 +966,7 @@
isoutput = 0
else:
isoutput = 1
- im = _image.fromarray(x, isoutput)
+ im = _image.frombyte(x, isoutput)
fc = self.figure.get_facecolor()
im.set_bg( *mcolors.colorConverter.to_rgba(fc, 0) )
im.is_grayscale = (self.cmap.name == "gray" and
@@ -1078,11 +1079,11 @@
im.is_grayscale = False
else:
if self._rgbacache is None:
- x = self.to_rgba(self._A, self._alpha)
+ x = self.to_rgba(self._A, self._alpha, bytes=True)
self._rgbacache = x
else:
x = self._rgbacache
- im = _image.fromarray(x, 0)
+ im = _image.frombyte(x, 0)
if len(self._A.shape) == 2:
im.is_grayscale = self.cmap.is_gray()
else:
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world?
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins