matplotlib - Matplotlib/Seaborn:自 3.3 起不推荐将非整数作为三元素位置规范传递
问题描述
我不明白这个错误信息:
MatplotlibDeprecationWarning: Passing non-integers as three-element position specification is deprecated since 3.3 and will be removed two minor releases later.
你能给我一个提示吗?
仅供参考,我的(不可执行)代码如下
import seaborn as sns
import matplotlib.pyplot as plt
for p in ps:
p_metrics = output_metrics.loc[output_metrics["p"] == p, :]
g = sns.relplot(x="k", y="metric_value", col="metric_name", hue="ref/eval", style="ref/eval",
col_wrap=np.ceil(np.sqrt(len(metrics))), palette="muted", kind="line",
dashes=False, legend="full", facet_kws={"sharex": False, "sharey": False},
data=p_metrics, markers=self.filled_markers)
g.savefig(f"plot_cat1_p={p}.png")
if show:
plt.show()
解决方案
我认为问题在于col_wrap=
期待 anint
并且您正在传递 a float
,尝试将其转换为 int:col_wrap=int(np.ceil(np.sqrt(len(metrics))))
推荐阅读
- tensorflow - tf.keras.optimizer('fo') 中的 optimizer.weights 是什么?
- c# - 如何制作游戏对象数组
- python-3.x - 'word' 变量在更新前循环并计数相同的字符串 9x
- uwp - 如何停止事件传播到父控件?
- javascript - 使用标签将 HTML5 画布保存为图像
- java - 如何排除 Cucumber 特征文件
- c# - How to set string array default value in a Class constructor
- python - replacement of "tf.gather_nd"
- haskell - 导管性能
- docker - 无法列出可用的 Docker 版本