matplotlib隐藏坐标轴

matplotlib隐藏坐标轴

matplotlib隐藏坐标轴:

1、方法一:

    # 隐藏坐标轴
    pyplot.axes().get_xaxis().set_visible(False)
    pyplot.axes().get_yaxis().set_visible(False)

使用该方法会抛出警告,不影响使用:

 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.
  pyplot.axes().get_yaxis().set_visible(False)

2、方法二:

    # 隐藏坐标轴
    pyplot.gca().get_xaxis().set_visible(False)
    pyplot.gca().get_yaxis().set_visible(False)
相关推荐
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页