我正在使用 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'
看来我的安装有问题,但是我能做什么呢?有什么建议吗?
最佳答案
如the release notes所示,matplotlib 1.4 中添加了 style
包。如果您想使用它,则需要升级。
关于python - matplotlib 布局类似于手动绘制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27004465/