[Matplotlib-users] Backtrace when including a legend with 0.98.5.1

2008-12-26 Thread Adam Mercer
Hi

I've noticed that one of my codes is failing with the following
backtrace since updating to 0.98.5.1:

Traceback (most recent call last):
  File "./plot_data.py", line 153, in 
fig.savefig(plot_file)
  File "/opt/local/lib/python2.5/site-packages/matplotlib/figure.py",
line 990, in savefig
self.canvas.print_figure(*args, **kwargs)
  File "/opt/local/lib/python2.5/site-packages/matplotlib/backend_bases.py",
line 1419, in print_figure
**kwargs)
  File 
"/opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py",
line 323, in print_png
FigureCanvasAgg.draw(self)
  File 
"/opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py",
line 279, in draw
self.figure.draw(self.renderer)
  File "/opt/local/lib/python2.5/site-packages/matplotlib/figure.py",
line 772, in draw
for a in self.axes: a.draw(renderer)
  File "/opt/local/lib/python2.5/site-packages/matplotlib/axes.py",
line 1601, in draw
a.draw(renderer)
  File "/opt/local/lib/python2.5/site-packages/matplotlib/legend.py",
line 347, in draw
bbox = self._legend_box.get_window_extent(renderer)
  File "/opt/local/lib/python2.5/site-packages/matplotlib/offsetbox.py",
line 198, in get_window_extent
px, py = self.get_offset(w, h, xd, yd)
  File "/opt/local/lib/python2.5/site-packages/matplotlib/offsetbox.py",
line 157, in get_offset
return self._offset(width, height, xdescent, ydescent)
  File "/opt/local/lib/python2.5/site-packages/matplotlib/legend.py",
line 299, in _findoffset_best
ox, oy = self._find_best_position(width, height)
  File "/opt/local/lib/python2.5/site-packages/matplotlib/legend.py",
line 699, in _find_best_position
consider = [self._get_anchored_bbox(x, bbox, self.parent.bbox) for
x in range(1, len(self.codes))]
TypeError: _get_anchored_bbox() takes exactly 5 arguments (4 given)
make: *** [data.png] Error 1

I can't remember seeing this with 0.98.5. This is clearly related to
the legend as if I remove the code that sets the legend:

x_axes.legend(([x1_plot], [x1_plot]), ("Duration",
  "Amount"), numpoints=1, loc=0, borderpad=2, shadow=True)

then the plot is produced as expected. Is this a regression, or am I
doing something odd with the legend?

Cheers

Adam

--
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Backtrace when including a legend with 0.98.5.1

2008-12-26 Thread John Hunter
On Fri, Dec 26, 2008 at 4:14 AM, Adam Mercer  wrote:
> Hi
>
> I've noticed that one of my codes is failing with the following
> backtrace since updating to 0.98.5.1:

Could you please post a complete, free-standing example?  Also, you
might want to test against 98.5.2 which has been released with some
legend fixes.

JDH

--
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Backtrace when including a legend with 0.98.5.1

2008-12-26 Thread Adam Mercer
On Fri, Dec 26, 2008 at 13:54, John Hunter  wrote:

> Could you please post a complete, free-standing example?  Also, you
> might want to test against 98.5.2 which has been released with some
> legend fixes.

Thanks John, updating to 0.98.5.2 fixes the problem.

Cheers

Adam

--
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users