Python-matplotlib-隐藏坐标轴时出现的警告
在《Python编程-从入门到实践》-【美】Eric Matthes 著,一书中第 301页,对于随机漫步5000点的项目,为了避免坐标轴干扰对随机漫步路径的注意,需要隐藏坐标轴。
环境:python3.9
出现的问题
import matplotlib.pyplot as plt
from random_walk import RandomWalk
while True:
# Create an instance and draw
rw = RandomWalk(50000)
rw.fill_walk()
# Hide axes
plt.axes().get_xaxis().set_visible(False)
plt.axes().get_yaxis().set_visible(False)
point_numbers = list(range(rw.num_points))
plt.scatter(rw.x_values, rw.y_values, c=point_numbers, cmap=plt