我想在matplotlib绘制数据。我想隐藏框的右上部分。有谁知道如何做到这一点?
谢谢你的帮助
刚刚成立的刺(和/或蜱)是无形的。
EG
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
plt.show()
如果你想隐藏在顶部的蜱离开为好,只是做:
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
想想也是这个选项:
import matplotlib.pyplot as plt
# Create your plot with your code
# Then extract the spines and make them invisible
ax = plt.gca()
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
plt.show() # Show your plot
要不就
import matplotlib.pyplot as plt
# Create your plot with your code
# Then extract the spines and make them invisible
plt.gca().spines['right'].set_color('none')
plt.gca().spines['top'].set_color('none')
plt.show() # Show your plot
希望它可以帮助别人