1

I'm following Sane color scheme for Matplotlib, but found that my coloring is still the same as the default color scheme. What could be wrong?

I was following Customizing plots with style sheets, and use these at the top of my code:

import matplotlib.pyplot as plt
plt.style.use('ggplot')

Is that the reason? Or something else?

Disclose,

The default color scheme in matplotlib is pretty ugly. Die-hard matlab/matplotlib fans may stand by their color scheme to the end, but it’s undeniable that Tableau’s default color scheme is orders of magnitude better than matplotlib’s.

UPDATE: showing that I am placing a valid matplotlibrc file at the correct place (which has explained here):

D:\>python
Python 3.5.0 |Anaconda 2.4.0 (64-bit)| (default, Dec  1 2015, 11:46:22) [MSC v.1
900 64 bit (AMD64)] on win32
>>> import matplotlib
>>> matplotlib.matplotlib_fname()
'D:\\Programs\\Anaconda3\\lib\\site-packages\\matplotlib\\mpl-data\\matplotlibrc
'
D:\>dir D:\Programs\Anaconda3\libs\site-packages\matplotlib\mpl-data\matplotlibrc
 Volume in drive D is New Volume

 Directory of D:\Programs\Anaconda3\libs\site-packages\matplotlib\mpl-data

12/18/2015  05:34 PM            25,738 matplotlibrc
               1 File(s)         25,738 bytes

1 Answer 1

1

From matplotlib 1.5 you can choose between a set of predefined styles (ggplot included).

If you want to create your own stylesheet you just have to place a valid matplotlibrc file somewhere and use

import matplotlib.pyplot as plt
plt.style.set("/path/to/your/file.mplstyle")

And then you could use your own style.

Sign up to request clarification or add additional context in comments.

3 Comments

However, I am placing a valid matplotlibrc file at the correct place, which should be picked up by default, without specifying plt.style.set, right? Thanks for the reply though.
Yes, it should. Could you post where is the correct place to check if it is the correct place? :-)
The "correct" place may depend on your OS / installation. To see where matplotlib is looking for the default matplotlibrc file, use print(matplotlib.get_configdir())

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.