デフォルトでは、x軸はグラフの下に、y軸は左側につけられる。
例
import numpy as np
from matplotlib import pyplot as plt
x = np.linspace(-10,10,100)
y = np.sin(x)
fig, ax = plt.subplots()
ax.scatter(x,y, s=100, alpha=0.3,label="sin")
ax.xaxis.set_ticks_position('top')
ax.yaxis.set_ticks_position('right')
plt.show()
結果
![](https://hanjouchan.org/wp-content/uploads/2021/07/screenshot-2021-06-17-at-9.48.19-1024x893.png)