【发布时间】:2017-03-20 23:34:40
【问题描述】:
我注意到这里报告的一个问题:Matplotlib style not working in pandas bar plot
但是用户有 Matplotlib 1.5。我的系统配置如下:
Python - 3.6.0
熊猫 - 0.19.2
Matplotlib - 2.0.0
Seaborn - 0.7.1
Jupyter - 4.4.1
Matplotlib 上的许多可用样式都不起作用。例如,
plt.style.use('seaborn-paper')
plt.rcParams["figure.figsize"] = (20,7)
df[["CHI"]].plot(kind="bar")
结果:
显然,seaborn-paper 样式尚未应用。这是一个错误,还是我做错了什么?
我使用的数据很简单,只有一列。
| | CHI |
|--------|-----|
| Red | 4 |
| Blue | 5 |
| Yellow | 8 |
| Green | 7 |
| White | 15 |
编辑:这些是我导入的库。
import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
【问题讨论】:
-
你进口了seaborn吗?它有自己的set_style 函数。
-
是的,我也进口了 seaborn。
-
你怎么知道没有应用seaborn-paper样式?
-
我之前用过(大约3天前,在朋友的系统上),结果是黑白主题,没有任何其他颜色。
标签: python pandas matplotlib seaborn