|
From: <ds...@us...> - 2007-08-16 12:53:17
|
Revision: 3710
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3710&view=rev
Author: dsdale
Date: 2007-08-16 05:53:13 -0700 (Thu, 16 Aug 2007)
Log Message:
-----------
added set_extent method to AxesImage
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/embedding_in_qt4.py
trunk/matplotlib/lib/matplotlib/image.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2007-08-14 14:13:27 UTC (rev 3709)
+++ trunk/matplotlib/CHANGELOG 2007-08-16 12:53:13 UTC (rev 3710)
@@ -1,3 +1,6 @@
+2007-08-16 Added a set_extent method to AxesImage, allow data extent
+ to be modified after initial call to imshow - DSD
+
2007-08-14 Fixed a bug in pyqt4 subplots-adjust. Thanks to
Xavier Gnata for the report and suggested fix - DSD
Modified: trunk/matplotlib/examples/embedding_in_qt4.py
===================================================================
--- trunk/matplotlib/examples/embedding_in_qt4.py 2007-08-14 14:13:27 UTC (rev 3709)
+++ trunk/matplotlib/examples/embedding_in_qt4.py 2007-08-16 12:53:13 UTC (rev 3710)
@@ -64,11 +64,13 @@
def compute_initial_figure(self):
self.axes.plot([0, 1, 2, 3], [1, 2, 0, 4], 'r')
+ self.axes.set_yscale('log')
def update_figure(self):
# Build a list of 4 random integers between 0 and 10 (both inclusive)
l = [ random.randint(0, 10) for i in xrange(4) ]
+ l[l<=0]=1
self.axes.plot([0, 1, 2, 3], l, 'r')
self.draw()
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py 2007-08-14 14:13:27 UTC (rev 3709)
+++ trunk/matplotlib/lib/matplotlib/image.py 2007-08-16 12:53:13 UTC (rev 3710)
@@ -236,6 +236,18 @@
# by mistake.
self.set_data(A)
+
+ def set_extent(self, extent):
+ """extent is data axes (left, right, bottom, top) for making image plots
+ """
+ self._extent = extent
+
+ xmin, xmax, ymin, ymax = extent
+ corners = (xmin, ymin), (xmax, ymax)
+ self.axes.update_datalim(corners)
+ if self.axes._autoscaleon:
+ self.axes.set_xlim((xmin, xmax))
+ self.axes.set_ylim((ymin, ymax))
def get_interpolation(self):
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|