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=期望int,而您正在传递float,请尝试将其强制转换为int:col_wrap=int(np.ceil(np.sqrt(len(metrics))))

相关内容

  • 没有找到相关文章

最新更新