プロットで軸をオンまたはオフにしたり、軸のサイズを適切に変更したりするのが困難です。私はいくつかのスレッドをたどりましたが、私の方法は次のとおりです。
f1=plt.figure(1,(3,3))
ax=Subplot(f1,111)
f1.add_subplot(ax)
ax.scatter(current,backg,label='Background Height')
ax.plot(current,backg)
ax.scatter(current,peak,color = 'red',label='Peak Spot Height')
ax.plot(current,peak,color='red')
ax.plot(current,meanspot,color='green')
ax.scatter(current,meanspot,color = 'green',label='Mean Spot Height')
ax.spines['left'].set_position('center')
ax.spines['right'].set_color('none')
ax.spines['bottom'].set_position('center')
ax.spines['top'].set_color('none')
ax.spines['left'].set_smart_bounds(True)
ax.spines['bottom'].set_smart_bounds(True)
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
しかし、私の図は依然として上部と右側に軸があり、軸のサイズ変更による奇妙なギャップがあります。