我正在关注 Sane color scheme for Matplotlib ,却发现我的着色是still the same作为the default color scheme .有什么问题吗?
我正在关注 Customizing plots with style sheets ,并在我的代码顶部使用这些:
import matplotlib.pyplot as plt
plt.style.use('ggplot')
是这个原因吗?或者是其他东西?
披露,
- 我对 huyng 于 2011 年 2 月 8 日创建的主旨进行了自己的修改。结果是 here .
- 自己修改的原因列在there以及。
- 解释了我把文件放在哪里there同样,之后我确实重新启动了 iphthon notebook。
- 我进行配色方案定制的原因是,引用自 How to make beautiful data visualizations in Python with matplotlib, Color matters
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.
更新: 显示我将有效的 matplotlibrc 文件放在正确的位置(已解释 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
请您参考如下方法:
从 matplotlib 1.5 开始,您可以在一组预定义样式(包括 ggplot)中进行选择。
如果你想创建your own stylesheet你只需要放置一个有效的 matplotlibrc 在某处归档并使用
import matplotlib.pyplot as plt
plt.style.set("/path/to/your/file.mplstyle")
然后您可以使用自己的风格。
