ConnectionPatch hidden by plots · Issue #8744 · matplotlib/matplotlib · GitHub
Skip to content

ConnectionPatch hidden by plots #8744

Description

@yha

A ConnectionPatch is sometimes not shown on one of the plots, depending on the position of the axesA and axesB subplots.

A reproducing example, with only minor changes to the ConnnectionPatch example from the docs:

from matplotlib.patches import ConnectionPatch
import matplotlib.pyplot as plt

fig, (ax1, ax2) = plt.subplots(1,2)

xy = (0.3, 0.2)
coordsA = "data"
coordsB = "data"
con = ConnectionPatch(xyA=xy, xyB=xy, coordsA=coordsA, coordsB=coordsB,
                      axesA=ax1, axesB=ax2,
                      arrowstyle="->", shrinkB=5)
ax1.add_artist(con)

# This works fine:
#con = ConnectionPatch(xyA=xy, xyB=xy, coordsA=coordsA, coordsB=coordsB,
#                      axesA=ax2, axesB=ax1,
#                      arrowstyle="->", shrinkB=5)
#ax2.add_artist(con)

ax1.set_xlim(0, 1)
ax1.set_ylim(0, 1)
ax2.set_xlim(0, .5)
ax2.set_ylim(0, .5)

plt.show()

This produces:

connectionpatch

Tested on matplotlib 2.0.2 (from Anaconda 4.4.0) on Debian.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions