Python plt close the coordinate axis, the scale is not visible

1. Close the coordinate scale (plt and AxesSubplot)

  • plt

    1.  
      plt .xticks ( [])
    2.  
      plt .yticks ( [])

    Close the axis:

    plt.axis('off')

    Note that if similar operations are to work, they need to be placed before plt.show () and after plt.imshow ().

 

  • 对于 ax(matplotlib.axes._subplots.AxesSubplot)

    1.  
      ax.set_xticks([])
    2.  
      ax.set_yticks([])

 

 

2. Set the dpi of the image to be saved

  • dpi:Dots Per Inch
plt.savefig(..., dpi=150)

 

3. The coordinate axis is not visible

  1.  
    frame = plt.gca()
  2.  
    # y axis is not visible
  3.  
    frame.axes.get_yaxis().set_visible( False)
  4.  
    # x axis is not visible
  5.  
    frame.axes.get_xaxis().set_visible( False)

 

 

Guess you like

Origin www.cnblogs.com/zb-ml/p/12695129.html