CHAPTER 05 · 作品已接入
共享坐标轴
用 sharex / sharey 让多个子图共享刻度。
import matplotlib.pyplot as plt
fig, axes = plt.subplots(2, 1, sharex=True, figsize=(8, 5))
axes[0].plot(x, y1, color='#ffb454')
axes[1].plot(x, y2, color='#ff5f9e')
plt.show()
CHAPTER 05 · 作品已接入
用 sharex / sharey 让多个子图共享刻度。
import matplotlib.pyplot as plt
fig, axes = plt.subplots(2, 1, sharex=True, figsize=(8, 5))
axes[0].plot(x, y1, color='#ffb454')
axes[1].plot(x, y2, color='#ff5f9e')
plt.show()