title: Flip arrow matplotlib
body: <p>I want create a plot in maptplotlib with arrows pointing to the startpoint of a line and pointing away from the endpoint of a line to visualize where a line start and where it ends (see figure). The upper arrow on the right side (YYArrow) looks right, but should point away from the endpoint. The Arrow shall be drawn in Figure space, not in data space.</p>
  
  <pre><code>from matplotlib import pyplot as plt
  
  def testplot():
      plt.plot([0, 1], [0, 1], 'r')
      plt.plot([0, 1], [0.9, 0.2], 'b-')
      plt.gcf().set_facecolor('w')
      plt.annotate("",
                  xy=(0, 0.9), xycoords='data',
                  xytext=(-25, 7), textcoords='offset points',
                  size=20, va="center", ha="center",
                  arrowprops=dict(ec='None',fc='k',
                                  width=1, frac=0.5, headwidth=5,
                                  ),
                  )
  
      plt.annotate("",
                  xy=(1, 0.2), xycoords='data',
                  xytext=(25, -7), textcoords='offset points',
                  size=20, va="center", ha="center",
                  arrowprops=dict(ec='None',fc='k',
                                  width=1, frac=0.5, headwidth=5,
                                  ),
                  )
  
      plt.annotate("",
                  xy=(1, 0.1), xycoords='data',
                  xytext=(25, -7), textcoords='offset points',
                  size=20, va="center", ha="center",
                  arrowprops=dict(arrowstyle="&lt;|-,head_length=0.5,head_width=0.1",
                                  connectionstyle="arc3,rad=-0.0",
                                  fc='k'
                                  ),
                  )
      plt.show()
  
  if __name__ == '__main__':
      testplot()
  </code></pre>
  
  <p>Problem: I want to specify a data point and a screen/figure offset, so that the arrow will always look the same, mo matter how the figure is scaled. Therefore it is necessary to use <code>textcoords='offset points'</code>. However, the better working <code>YYArrow</code> cannot be reversed (at least I do not know how).</p>
  
  <p><code>arrowstyle="&lt;|-"</code> is working (reversing the arrow), but it is inferior (rounded corners instead of miter, much slower in interactive mode for > 50 arrows), maybe because it has to draw face <strong>and</strong> edge.</p>
  
  <p>So I am searching for either a way to "flip" the <code>YYArrow</code> or be able to calculate (transformations?) the data point <code>xy=...</code> to which the arrow points given the offset in pixels, but I am not sure how. </p>
  
  <p><img src="https://i.stack.imgur.com/YvNLp.png" alt="Sample for YYArrows"></p>