python - MatplotlibDeprecationWarning 向子图添加背景颜色时
问题描述
我正在尝试从数据集中创建一个箱形图,然后更改每个子图的背景颜色:
url = "https://raw.githubusercontent.com/jbrownlee/Datasets/master/iris.csv"
column_names = ['sepal-length', 'sepal-width', 'petal-length', 'petal-width', 'class']
data_set = read_csv(url, names=column_names)
data_set.plot(kind="box", subplots=True, color="yellow", layout=(2, 2), sharex=False, sharey=False)
pyplot.subplot(221).set_facecolor("red")
pyplot.subplot(222).set_facecolor("purple")
pyplot.subplot(223).set_facecolor("green")
pyplot.subplot(224).set_facecolor("blue")
pyplot.show()
我确实得到了彩色子图,但是,我不断收到警告消息:
MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance. In a future version, a new instance will always be created and returned. Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
有谁知道如何解决这个问题?
解决方案
推荐阅读
- c++ - 由于 C++ 程序末尾的 malloc 导致的 Seg Fault
- node.js - 删除 lex bot 和所有关联的别名
- hbase - 列族的更改编号不起作用
- android - 是否可以使用新的 Material Components 将应用程序发布到 Play 商店?
- html - 如何修复 $route.current 在 AngularJS 中未定义
- django - Django - 检查数据库中的会话变量
- c# - MVC C# 填充嵌套对象 AJAX JSON JQuery
- javascript - 如果我在两个选择之间添加一个 div,Javascript 不起作用
- c# - 带有动画 GIF 的启动画面在 WPF C# 中没有动画效果
- java - 在 Activity/App 进入后台 60 秒后调用方法