|
From: Peter G. <pgr...@ge...> - 2004-05-28 03:21:16
|
John Hunter wrote:
>>>>>>"Peter" == Peter Groszkowski <pgr...@ge...> writes:
>>>>>>
>
> Peter> Hi: The following script:
>
> Peter> #!/usr/bin/env python from matplotlib.matlab import *
>
> Peter> figure(1) plot([0],[0]) show()
>
>Thanks, Peter, for alerting me to this problem. I'm now adding this
>script and several other instances of plotting constants in a variety
>of guises to the unit testing scripts. I think the following fix will
>work for you. Replace matplotlib.axes.Axes.add_line with
>
> def add_line(self, l):
> "Add a line to the list of plot lines"
> self._set_artist_props(l)
>
> xdata = l.get_xdata()
> ydata = l.get_ydata()
> if l.get_transform() != self.transData:
> xys = self._get_verts_in_data_coords(
> l.get_transform(), zip(xdata, ydata))
> self.update_datalim(xys)
> else:
> # the data are already using the data coord system - no
> # transforms necessary
> minx, maxx = min(xdata), max(xdata)
> miny, maxy = min(ydata), max(ydata)
> if minx==maxx:
> minx -= 1
> maxx += 1
>
> if miny==maxy:
> miny -= 1
> maxy += 1
>
> corners = ( (minx, miny), (maxx, maxy) )
>
> self.update_datalim(corners)
>
> l.set_clip_box(self.bbox)
> self._lines.append(l)
>
>Passes my tests...
>
>
Just a note that the version of the above method in 0.54.1 still gives me:
Traceback (most recent call last):
File
"/usr/lib/python2.2/site-packages/matplotlib/backends/backend_gtkagg.py",
line 75, in callback
self.draw()
File
"/usr/lib/python2.2/site-packages/matplotlib/backends/backend_gtkagg.py",
line 42, in draw
agg.draw()
File
"/usr/lib/python2.2/site-packages/matplotlib/backends/backend_agg.py",
line 296, in draw
self.figure.draw(self.renderer)
File "/usr/lib/python2.2/site-packages/matplotlib/figure.py", line
130, in draw
for a in self.axes: a.draw(renderer)
File "/usr/lib/python2.2/site-packages/matplotlib/axes.py", line 607,
in draw
self.xaxis.draw(renderer)
File "/usr/lib/python2.2/site-packages/matplotlib/axis.py", line 463,
in draw
tick.draw(renderer)
File "/usr/lib/python2.2/site-packages/matplotlib/axis.py", line 130,
in draw
if self.label1On: self.label1.draw(renderer)
File "/usr/lib/python2.2/site-packages/matplotlib/text.py", line 209,
in draw
ismath=self.is_math_text())
File
"/usr/lib/python2.2/site-packages/matplotlib/backends/backend_agg.py",
line 200, in draw_text
self._renderer.draw_text(
OverflowError: float too large to convert
When doint plot([0],[0]).
The above substitute fixes the problem though...
--
Peter Groszkowski Gemini Observatory
Tel: +1 808 974-2509 670 N. A'ohoku Place
Fax: +1 808 935-9235 Hilo, Hawai'i 96720, USA
|