Custom plots broken on hardy (LineCollection instance has no attribute 'get_lines')

Bug #532504 reported by Daniel Bültmann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openWNS Wrowser
New
Undecided
Unassigned

Bug Description

Hi,

I tried to use the new export to Python function on hardy. The export itself works well, but after starting the script in a shell I get the following error in matplotlib. Version information is below

# python hansl.py
Accessing charts from database server with campaignId: 1586
Reading Campaign
Creating Facade: done
Found 2370 scenarios
Plotting: hansl
Traceback (most recent call last):
  File "hansl.py", line 55, in <module>
    if __name__ == '__main__': wrowser.FigurePlotter.loadCampaignAndPlotGraphs(PlotParameters)
  File "/home/dbn/src/openWNS/openwns-wrowser/wrowser/FigurePlotter.py", line 135, in loadCampaignAndPlotGraphs
    savefig(os.path.join(outputdir, PlotParameters.fileName+'.pdf'))
  File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 269, in savefig
    return fig.savefig(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 782, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line 1195, in print_figure
    **kwargs)
  File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line 1104, in print_pdf
    return pdf.print_pdf(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py", line 1967, in print_pdf
    self.figure.draw(renderer)
  File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 624, in draw
    for a in self.axes: a.draw(renderer)
  File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 1345, in draw
    a.draw(renderer)
  File "/usr/lib/python2.5/site-packages/matplotlib/legend.py", line 236, in draw
    self._update_positions(renderer)
  File "/usr/lib/python2.5/site-packages/matplotlib/legend.py", line 579, in _update_positions
    ox, oy = self._find_best_position(w, h)
  File "/usr/lib/python2.5/site-packages/matplotlib/legend.py", line 463, in _find_best_position
    verts, bboxes, lines = self._auto_legend_data()
  File "/usr/lib/python2.5/site-packages/matplotlib/legend.py", line 378, in _auto_legend_data
    hlines = handle.get_lines()
AttributeError: LineCollection instance has no attribute 'get_lines'

# python
Python 2.5.2 (r252:60911, Jan 20 2010, 21:48:48)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

Matplotlib
>>> import matplotlib
>>> print matplotlib.__version__
0.91.2
>>>

Can you please try to make this work on hardy?

Regards,
  Daniel

Revision history for this message
Ramin Rezai Rad (rrr-comnets) wrote :

Hi Daniel,

can you please try to create a png file instead of the pdf file? To do so you can export with wrowser revision 63 (or you use an older revision and edit FigurePlotter.py) . In the generated script you can specify the output formats. I would like to know if this is only a problem with the pdf backend.

Another question: Did the script run on karmic without problems?

Best regards,
 Ramin

Revision history for this message
Ramin Rezai Rad (rrr-comnets) wrote :

Hi again,

this seems to be a bug in matplotlib that does not occur very often. A workaround seems to be to change the legendPosition parameter in the export file, from 'best' to another value like 'upper left'.

Best regards,
 Ramin

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.