It is a bug that is fixed in svn. The "this" part of the names is
incorrect. The revised function is:
def xaxis_date(self, tz=None):
"""Sets up x-axis ticks and labels that treat the x data as dates.
tz is the time zone to use in labeling dates. Defaults to rc
value.
"""
locator = self.xaxis.get_major_locator()
if not isinstance(locator, DateLocator):
locator = AutoDateLocator(tz)
self.xaxis.set_major_locator(locator)
formatter = self.xaxis.get_major_formatter()
if not isinstance(formatter, DateFormatter):
formatter = AutoDateFormatter(locator)
self.xaxis.set_major_formatter(formatter)
Similarly for yaxis_date.
Eric
Joshua J. Kugler wrote:
> We had some working code were were using with 0.87, but when we try to use it
> with 0.90, we get the following error:
>
> File "/usr/local/lib/python2.4/site-packages/EEIGraph/BaseGraph.py", line
> 250,
> in plotDate
> line = self.main_axes.plot_date( g[:,0], g[:,1] )
>
> File
> "/usr/lib/python2.4/site-packages/matplotlib-0.90.0-py2.4-linux-i686.egg/matplotlib/axes.py",
>
> line 2395, in plot_date
> self.xaxis_date(tz)
>
> File
> "/usr/lib/python2.4/site-packages/matplotlib-0.90.0-py2.4-linux-i686.egg/matplotlib/axes.py",
>
> line 1564, in xaxis_date
> formatter = AutoDateFormatter(locator)
> UnboundLocalError: local variable 'locator' referenced before assignment
>
> It happens in this function:
>
> def xaxis_date(self, tz=None):
> """Sets up x-axis ticks and labels that treat the x data as dates.
>
> tz is the time zone to use in labeling dates. Defaults to rc value.
> """
>
> thislocator = self.xaxis.get_major_locator()
> if not isinstance(thislocator, DateLocator):
> locator = AutoDateLocator(tz)
> self.xaxis.set_major_locator(locator)
>
> thisformatter = self.xaxis.get_major_formatter()
> if not isinstance(thisformatter, DateFormatter):
> formatter = AutoDateFormatter(locator)
> self.xaxis.set_major_formatter(formatter)
>
> It seems to happen when thislocator is an AutoDateLocator, thus locator is an
> AutoDateLocator, thus locator is not set, but thisformatter is a
> AutoDateFormatter, which doesn't seem to satisfy isinstance(thisformatter,
> DateFormatter)
>
> I don't know enough about matplotlib internals to speculate further.
>
> Any hints?
>
> j
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users