|
1 つの図の軸上のデータ制限を他の図の軸と接続します。 これは、同じ図の 2 つの軸に対してこれを行う正しい方法ではありません - その場合は sharex と sharey プロパティを使用します
"""
connect the data limits on the axes in one figure with the axes in
another. This is not the right way to do this for two axes in the
same figure -- use the sharex and sharey property in that case
"""
import numpy as np
import matplotlib.pyplot as plt
fig1 = plt.figure()
fig2 = plt.figure()
ax1 = fig1.add_subplot(111)
ax2 = fig2.add_subplot(111, sharex=ax1, sharey=ax1)
ax1.plot(np.random.rand(100), 'o')
ax2.plot(np.random.rand(100), 'o')
# In the latest release, it is no longer necessary to do anything
# special to share axes across figures:
# ax1.sharex_foreign(ax2)
# ax2.sharex_foreign(ax1)
# ax1.sharey_foreign(ax2)
# ax2.sharey_foreign(ax1)
plt.show()
|