python - matplotlib 布局类似于手动绘制

标签 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'

看来我的安装有问题,但是我能做什么呢?有什么建议吗?

最佳答案

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

关于python - matplotlib 布局类似于手动绘制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27004465/

相关文章:

python - 如何将数据集拆分为训练集和验证集并保持类之间的比例?

python - 为什么线性回归图不正确?提供代码和图片

python - 多边形内的轮廓不规则数据

python - 如何制作Python图像 'fit'这个数字?

image-processing - Keras:可视化 ImageDataGenerator 输出

r - 为 R 中的 ggplot2 中的两个变量制作分箱散点图

python - Tensorflow 2.3.0 未检测到 GPU

Python Pygame贪吃蛇游戏项目混淆

python - 如何在一行中合并 python 中的值和范围或列表?

python - 将数据集与绘图进行比较 - 将虚线与实线混合