It would seem the `axesA` keyword always has to be the "latest" axes. If
not, the connector does not get added to the figure.

Minimal, complete and verifiable example:
######
from matplotlib.patches import ConnectionPatch
import matplotlib.pyplot as plt
import matplotlib as mpl
import platform

print(mpl.__version__)
print(platform.python_version())

xya = (.5,.5)
xyb = (.6,.7)

# shows nothing
f1, (ax11, ax12) = plt.subplots(1,2, sharey=False)
con1 = ConnectionPatch(xyA=xya, xyB=xyb , coordsA='data', coordsB='data',
axesA=ax12, axesB=ax11)
ax11.add_artist(con1)

# shows clipped line
f2, (ax21, ax22) = plt.subplots(1,2, sharey=False)
con2 = ConnectionPatch(xyA=xyb, xyB=xya , coordsA='data', coordsB='data',
axesA=ax21, axesB=ax22)
ax21.add_artist(con2)

# shows desired result
f3, (ax31, ax32) = plt.subplots(1,2, sharey=False)
con3 = ConnectionPatch(xyA=xya, xyB=xyb , coordsA='data', coordsB='data',
axesA=ax32, axesB=ax31)
ax32.add_artist(con3)

# shows nothing
f4, (ax41, ax42) = plt.subplots(1,2, sharey=False)
con4 = ConnectionPatch(xyA=xyb, xyB=xya , coordsA='data', coordsB='data',
axesA=ax41, axesB=ax42)
ax42.add_artist(con4)

plt.draw()
plt.show()

######

While reference to clipping is made in the user guide[1], the seemingly
forced choice of `axesA` had me stumped for quite some time. While I
understand that the choice of the axes to add the connector is important to
avoid overlap (in other words, on which axes one should call the
`add_artist` method), it seems unimportant whether xyA or xyB are
referenced in ax1 or ax2.

To clarify: I was expecting example 4 above to show a similar line as
example 3.


[1]: http://matplotlib.org/users/annotations_guide.html#using-connectorpatch
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to