当前位置: 代码迷 >> 综合 >> Passing non-integers as three-element position specification is deprecated since 3.3
  详细解决方案

Passing non-integers as three-element position specification is deprecated since 3.3

热度:72   发布时间:2023-10-26 00:13:02.0

0.环境

ubuntu16.04
matplotlib==3.3.1

1.matplotlib问题

plt.subplot(row_num, row_num, index)

Passing non-integers as three-element position specification is deprecated since 3.3 and will be removed two minor releases later.

翻译:

从3.3开始,不推荐将非整数作为三元素位置规范传递,并将在两个次要版本之后删除。

 

2.分析

看到deprecated以为是版本问题,翻译出来之后就很清晰了。

原来是row_num最后是浮点型。

 

3.解决

import matplotlib.pyplot as plt
plt.subplot(int(row_num), int(row_num), index)

 

  相关解决方案