With matplotlib, I make a shape containing two Axes objects (i.e. two sets of xy-axes). I want to connect two points - one selected from one of the axes, and the other selected from the other axis - an arrow or a line.
I tried to do this using the annotate () function and the ConnectionPatch object, but in both directions, part of the arrow was hidden by the "frame" of the axis. See the attached figure, in which I tried to relate the origin of two axes using the ConnectionPatch object.
I also attach the script used to create the shape.
Is there a way to βextendβ the arrow (or move the axis frame back)?

import matplotlib.pyplot as plt
from matplotlib.patches import ConnectionPatch
fig=plt.figure(figsize=(10,5))
ax1=plt.axes([0.05,0.15,0.40,0.80])
plt.xticks([0])
plt.yticks([0])
plt.xlim((-1.23, 1.23))
plt.ylim((-2.34, 2.34))
ax2=plt.axes([0.60,0.15, 0.30, 0.30])
plt.xticks([0])
plt.yticks([0])
plt.xlim((-3.45, 3.45))
plt.ylim((-4.56, 4.56))
con = ConnectionPatch(xyA=(0, 0), xyB=(0, 0),
coordsA='data', coordsB='data',
axesA=ax1, axesB=ax2,
arrowstyle='->', clip_on=False)
ax1.add_artist(con)
plt.savefig('fig1.eps')
plt.savefig('fig1.png')
norio source
share