Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Matplotlib custom style error

i'm trying to use a custom matplotlib-style

But it does not work:

As mentioned here:

http://matplotlib.org/users/style_sheets.html

i tried the following:

import matplotlib.pyplot as plt
print plt.style.available

matplotlib.pyplot works fine. But it keeps saying that style is not defined.

>>> import matplotlib.pyplot as plt
>>> print plt.style.available
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'style'

What is the solution?

It is Mac Os X Yosemite and it is installed as Administrator in the default location.

like image 424
user3613886 Avatar asked Jan 10 '23 09:01

user3613886


1 Answers

Styles are a very recent feature of matplotlib, introduced in version 1.4.

  • If your version of matplotlib is up-to-date then you are suffering from a bug of the installation procedure

  • If your version is older than 1.4 then it is not expected that you have style sheets installed.

To look at your version, do the following (my matplotlib is old...)

>>> import matplotlib
>>> matplotlib.__version__
'1.3.1'
>>>
like image 192
gboffi Avatar answered Jan 11 '23 23:01

gboffi