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

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)

 

你可能感兴趣的:(python,matplotlib)