matplotlib布局就像手工绘制

时间:2014-11-18 21:33:21

标签: python matplotlib plot stylesheet

我正在使用matplotlib进行绘图,并试图获得一个像plotly一样的漂亮布局。特别是我想要一个带有填充和轮廓的条形图/箱形图,颜色相同。不是默认的黑色/灰色轮廓和彩色轮廓,而是像plotly。没有样式表的任何建议?

以下解决了:

因为通过搜索解决方案,我找到了样式表,但是我收到以下错误消息,尝试在官方manual之后加载python matplotlib中的特定样式表:

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

同样的问题:

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

有关系统的信息:

>>> matplotlib.__version__
'1.3.1'

所以我的安装似乎有问题,但我该怎么办?有什么建议吗?

1 个答案:

答案 0 :(得分:3)

the release notes所示,在matplotlib 1.4中添加了style包。如果要使用它,则需要升级。