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

Skip to content

Commit a331393

Browse files
committed
Fix bug introduced in 8308: allow vmin == vmax
svn path=/trunk/matplotlib/; revision=8331
1 parent 279887f commit a331393

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

lib/matplotlib/colors.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -810,11 +810,8 @@ def __call__(self, value, clip=None):
810810
def inverse(self, value):
811811
if not self.scaled():
812812
raise ValueError("Not invertible until scaled")
813-
vmin, vmax = self.vmin, self.vmax
814-
if vmin >= vmax:
815-
raise ValueError("Inversion requires valid vmax > vmin")
816-
vmin = float(vmin)
817-
vmax = float(vmax)
813+
vmin = float(self.vmin)
814+
vmax = float(self.vmax)
818815

819816
if cbook.iterable(value):
820817
val = ma.asarray(value)

lib/matplotlib/dates.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ def _get_interval(self):
512512
Return the number of units for each tick.
513513
"""
514514
return 1
515-
515+
516516
def nonsingular(self, vmin, vmax):
517517
unit = self._get_unit()
518518
interval = self._get_interval()
@@ -561,7 +561,7 @@ def __call__(self):
561561
if estimate > self.MAXTICKS * 2:
562562
raise RuntimeError(
563563
'RRuleLocator estimated to generate %d ticks from %s to %s: exceeds Locator.MAXTICKS * 2 (%d) ' % (estimate, dmin, dmax, self.MAXTICKS * 2))
564-
564+
565565
dates = self.rule.between(dmin, dmax, True)
566566
if len(dates) == 0:
567567
return date2num([dmin, dmax])
@@ -597,7 +597,7 @@ def get_unit_generic(freq):
597597

598598
def _get_interval(self):
599599
return self.rule._rrule._interval
600-
600+
601601
def autoscale(self):
602602
"""
603603
Set the view limits to include the data range.
@@ -868,7 +868,7 @@ def autoscale(self):
868868
vmax = date2num(vmax)
869869
return self.nonsingular(vmin, vmax)
870870

871-
871+
872872
class MonthLocator(RRuleLocator):
873873
"""
874874
Make ticks on occurances of each month month, eg 1, 3, 12.
@@ -925,7 +925,7 @@ def __init__(self, bymonthday=None, interval=1, tz=None):
925925
interval=interval, **self.hms0d)
926926
RRuleLocator.__init__(self, o, tz)
927927

928-
928+
929929
class HourLocator(RRuleLocator):
930930
"""
931931
Make ticks on occurances of each hour.
@@ -943,7 +943,7 @@ def __init__(self, byhour=None, interval=1, tz=None):
943943
byminute=0, bysecond=0)
944944
RRuleLocator.__init__(self, rule, tz)
945945

946-
946+
947947
class MinuteLocator(RRuleLocator):
948948
"""
949949
Make ticks on occurances of each minute.
@@ -961,7 +961,7 @@ def __init__(self, byminute=None, interval=1, tz=None):
961961
bysecond=0)
962962
RRuleLocator.__init__(self, rule, tz)
963963

964-
964+
965965
class SecondLocator(RRuleLocator):
966966
"""
967967
Make ticks on occurances of each second.

0 commit comments

Comments
 (0)