一、总结

一句话总结:

去掉上边框:ax.spines['top'].set_visible(False)
fig, ax = plt.subplots()
# 取消边框
for key, spine in ax.spines.items():
    # 'left', 'right', 'bottom', 'top'
    if key == 'left' or key == 'right':
        spine.set_visible(False)

 

 

 

二、matplotlib去掉边框

 

import numpy as np
import matplotlib.pyplot as plt

fig, ax = plt.subplots()
# 取消边框
for key, spine in ax.spines.items():
    # 'left', 'right', 'bottom', 'top'
    if key == 'left' or key == 'right':
        spine.set_visible(False)
plt.xticks([])
plt.yticks([])
x=[1,2,3,4,5]
y=[4,9,6,8,3]
plt.plot(x,y,'ro')
plt.plot(x,y,'k--')
plt.show()

 

matplotlib去掉边框

 

 

 

 

 

相关文章:

  • 2021-08-03
  • 2022-02-14
  • 2022-02-15
  • 2022-12-23
  • 2021-07-18
  • 2021-12-10
  • 2021-11-29
  • 2021-05-01
猜你喜欢
  • 2021-10-02
  • 2022-01-04
  • 2022-12-23
  • 2022-12-23
  • 2022-02-27
相关资源
相似解决方案