|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- import matplotlib.pyplot as plt
- input_values = [1,2,3,4,5]
- squares = [1, 4, 9, 16, 25]
- plt.plot(input_values, squares, linewidth=5)
- plt.title("Square Number", fontsize=24)
- plt.xlabel("Value", fontsize=14)
- plt.ylabel("Square of value", fontsize=14)
- plt.axes().get_xaxis().set_visible(False)#隐藏x轴
- plt.axes().get_yaxis().set_visible(False)#隐藏y轴
- plt.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.
- warnings.warn(message, mplDeprecation, stacklevel=1)
复制代码
该怎么解决呢?
- import matplotlib.pyplot as plt
- input_values = [1, 2, 3, 4, 5]
- squares = [1, 4, 9, 16, 25]
- plt.plot(input_values, squares, linewidth=5)
- plt.xticks([])
- plt.yticks([])
- plt.show()
复制代码
|
|