Revision: 7676
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7676&view=rev
Author: jdh2358
Date: 2009-09-07 18:42:41 +0000 (Mon, 07 Sep 2009)
Log Message:
-----------
raise if num ticks exceeds some threshold to address sf bug 2715172
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/dates.py
trunk/matplotlib/lib/matplotlib/tests/test_dates.py
trunk/matplotlib/lib/matplotlib/ticker.py
trunk/matplotlib/lib/matplotlib/transforms.py
Modified: trunk/matplotlib/lib/matplotlib/dates.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/dates.py 2009-09-07 17:18:44 UTC (rev
7675)
+++ trunk/matplotlib/lib/matplotlib/dates.py 2009-09-07 18:42:41 UTC (rev
7676)
@@ -522,6 +522,8 @@
self.rule.set(dtstart=start, until=stop)
dates = self.rule.between(dmin, dmax, True)
+ if len(dates)>=ticker.Locator.MAXTICKS:
+ raise RuntimeError('RRuleLocator attempting to generate %d ticks
from %s to %s: exceeds matplotlib.ticker.Locator.MAXTICKS'%(len(dates),
dates[0], dates[-1]))
return date2num(dates)
def _get_unit(self):
Modified: trunk/matplotlib/lib/matplotlib/tests/test_dates.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/tests/test_dates.py 2009-09-07 17:18:44 UTC
(rev 7675)
+++ trunk/matplotlib/lib/matplotlib/tests/test_dates.py 2009-09-07 18:42:41 UTC
(rev 7676)
@@ -1,6 +1,6 @@
import datetime
import numpy as np
-from matplotlib.testing.decorators import image_comparison
+from matplotlib.testing.decorators import image_comparison, knownfailureif
import matplotlib.pyplot as plt
@image_comparison(baseline_images=['date_empty'])
@@ -66,7 +66,10 @@
fig.autofmt_xdate()
fig.savefig('date_axvline')
-...@image_comparison(baseline_images=['date_xlim_empty'])
+# we want to test that this method raises a RuntimeError -- what is
+# the rightway to do this in the current framework
+...@knownfailureif(True)
+...@image_comparison(baseline_images=['date_xlim_empty'])
def test_set_xlim_and_unexpected_handling():
# Attempt to test SF 2715172, see
#
https://sourceforge.net/tracker/?func=detail&aid=2715172&group_id=80706&atid=560720
@@ -80,7 +83,7 @@
ax.xaxis.set_major_locator(DayLocator())
ax.xaxis.set_major_formatter(DateFormatter("%m/%d/%y, %I:%M%p"))
ax.xaxis.set_minor_locator(HourLocator())
- if 1:
+ if 0:
# this seems to cause an ininite loop.
from nose.plugins.skip import SkipTest
raise SkipTest('avoiding never-ending drawing')
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py 2009-09-07 17:18:44 UTC (rev
7675)
+++ trunk/matplotlib/lib/matplotlib/ticker.py 2009-09-07 18:42:41 UTC (rev
7676)
@@ -657,7 +657,14 @@
because the locator stores references to the Axis data and view
limits
"""
-
+
+ # some automatic tick locators can generate so many ticks they
+ # kill the machine when you try and render them, see eg sf bug
+ # report
+ #
https://sourceforge.net/tracker/index.php?func=detail&aid=2715172&group_id=80706&atid=560720.
+ # This parameter is set to cause locators to raise an error if too
+ # many ticks are generated
+ MAXTICKS = 1000
def __call__(self):
'Return the locations of the ticks'
raise NotImplementedError('Derived must override')
Modified: trunk/matplotlib/lib/matplotlib/transforms.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/transforms.py 2009-09-07 17:18:44 UTC
(rev 7675)
+++ trunk/matplotlib/lib/matplotlib/transforms.py 2009-09-07 18:42:41 UTC
(rev 7676)
@@ -2266,6 +2266,7 @@
else:
vmin -= expander*abs(vmin)
vmax += expander*abs(vmax)
+
if swapped and not increasing:
vmin, vmax = vmax, vmin
return vmin, vmax
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins