1

I have a python program using matplotlib which runs nicely under windows vista but under Ubuntu I get the following error:

Traceback (most recent call last):
  File "Main.py", line 175, in my_measure
    self.widget.canvas.ax.legend(loc = 'center left', bbox_to_anchor = (2.2, 0.5), ncol = 1, fontsize = 10) # defining the legend properties, such as positioning and labels fontsize
  File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 4519, in legend
    self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'fontsize'

I don't understand why 'fontsize' became an unexpected keyword argument. Anybody can help?

Thanks

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • 1
    Two questions here. 1. Are the versions of the matplotlib the same between the Windows and Linux environments? 2. If the version numbers are the same, would it be possible for you to confirm that they're the same using a full directory diff tool (e.g. diffmerge on windows, or diff on linux)? – bitcycle Feb 11 '13 at 16:02
  • Hi. Sorry I am not an expert and could not clearly understand your questions. How could I access the matplotlib versions I have installed? –  Feb 11 '13 at 16:11
  • For checking matplotlib version (on both windows and linux): `python -c "import matplotlib as l; print l.__version__"`. For finding where on the file system the matplotlib directory is: `python -c "import matplotlib as l; print l.__path__[0]"` – bitcycle Feb 11 '13 at 16:48
  • Also, here's a link to [diff merge](http://www.sourcegear.com/diffmerge). If you can copy the matplotlib from ubuntu over to the windows side, then perform the directory diff there, the graphical tool will be much easier to look at. – bitcycle Feb 11 '13 at 16:50
  • Hi,Thanks! It solved the problem. The version installed in Ubuntu was the 1.1.0 and under windows was 1.2.0 which could handle all the stuff I coded. Just for information using the apt-get install python-matplotlib on the shell installed the version 1.1.0. So I had to install the 1.2.0 by untar the respective version downloaded from the matplotlib website and install it through the shell via python setup.py install. –  Feb 12 '13 at 13:09

0 Answers0