Skip to content

Commit 84ede56

Browse files
author
James Evans
committed
Added a line to Axis.convert_units that gets the proper converter if None is set.
Removed a line from Axis.set_units that sets the converter to None if the units is set to None. svn path=/trunk/matplotlib/; revision=3236
1 parent c07b48e commit 84ede56

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/axis.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,9 @@ def _update_axisinfo(self):
823823
label.set_text(info.label)
824824

825825
def convert_units(self, x):
826+
if self.converter is None:
827+
self.converter = units.registry.get_converter(x)
828+
826829
if self.converter is None:
827830
#print 'convert_units returning identity: units=%s, converter=%s'%(self.units, self.converter)
828831
return x
@@ -840,7 +843,6 @@ def set_units(self, u):
840843
pchanged = False
841844
if u is None:
842845
self.units = None
843-
self.converter = None
844846
pchanged = True
845847
else:
846848
if u!=self.units:

0 commit comments

Comments
 (0)