1

I'm using PyCharm on an ubuntu 14.04.1 LTS with python3. I want to use the 'ggplot' style module, but I get an 'no module named' error. Matplotlib 1.3.1 is installed and works fine (I updated it recently).

import matplotlib as mpl
import matplotlib.style as mplstyle
mplstyle.use('ggplot')

ImportError: No module named 'matplotlib.style'

I also checked for the matplotlibrc file and matplotlibtool and everything seems to be as the documentation recommends. Anyone knows, what I can do?

1 Answer 1

1

According to What's new in matplotlib, the style package was added to matplotlib since version 1.4.

So, check your matplotlib version by,

$ pip freeze | grep matplotlib
matplotlib==1.3.1

Upgrade matplotlib to the newest version by,

$ sudo pip install matplotlib --upgrade

$ pip freeze | grep matplotlib
matplotlib==1.5.1

This works fine for me.

import matplotlib.pyplot as plt
plt.style.use('ggplot')
Sign up to request clarification or add additional context in comments.

1 Comment

I needed to upgrade the libfreetype6 first by sudo apt-get install libfreetype6-dev and after that update it in pycharm of course. But then it works fine. thanks a lot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.