Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8f36d8e

Browse files
author
James Evans
committed
The previous fix broke the current behaviour of being able to explicitly set a new unit type for a
specific axis after it was already set. This fixes that. svn path=/trunk/matplotlib/; revision=6100
1 parent a9f5f7a commit 8f36d8e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/matplotlib/axes.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,11 +1391,17 @@ def _process_unit_info(self, xdata=None, ydata=None, kwargs=None):
13911391
if xunits!=self.xaxis.units:
13921392
#print '\tkw setting xunits', xunits
13931393
self.xaxis.set_units(xunits)
1394+
# If the units being set imply a different converter, we need to update.
1395+
if xdata is not None:
1396+
self.xaxis.update_units(xdata)
13941397

13951398
yunits = kwargs.pop('yunits', self.yaxis.units)
13961399
if yunits!=self.yaxis.units:
13971400
#print '\tkw setting yunits', yunits
13981401
self.yaxis.set_units(yunits)
1402+
# If the units being set imply a different converter, we need to update.
1403+
if ydata is not None:
1404+
self.yaxis.update_units(ydata)
13991405

14001406
def in_axes(self, mouseevent):
14011407
'''

0 commit comments

Comments
 (0)