Arrow annotations behave differently between 1.3.1 and 1.4.2 · Issue #4012 · matplotlib/matplotlib · GitHub
Skip to content

Arrow annotations behave differently between 1.3.1 and 1.4.2 #4012

Description

@QuLogic

Sorry, here's another one without a simplified test case. I will try and get to that tomorrow. For this, you will need matplotlib 1.4.2 and the development version of ObsPy. Then run obspy3-runtests -d obspy.station.tests.test_station.StationTest.test_response_plot. Test case is below.

With mpl 1.3.1, the plot is as so:
station_response

With mpl 1.4.2 (and master), the plot is as so:
station_response

station_response-failed-diff

You can see that the arrows are thinner and shifted a bit.

I believe the relevant bit of code is the following, but I will try to simplify it later:

            trans_above = blended_transform_factory(ax1.transData,
                                                    ax1.transAxes)
            trans_right = blended_transform_factory(ax1.transAxes,
                                                    ax1.transData)
            arrowprops = dict(
                arrowstyle="wedge,tail_width=1.4,shrink_factor=0.8", fc=color)
            bbox = dict(boxstyle="round", fc="w")
            ax1.annotate("%.1g" % self.instrument_sensitivity.frequency,
                         (self.instrument_sensitivity.frequency, 1.0),
                         xytext=(self.instrument_sensitivity.frequency, 1.1),
                         xycoords=trans_above, textcoords=trans_above,
                         ha="center", va="bottom",
                         arrowprops=arrowprops, bbox=bbox)
            ax1.annotate("%.1e" % self.instrument_sensitivity.value,
                         (1.0, self.instrument_sensitivity.value),
                         xytext=(1.05, self.instrument_sensitivity.value),
                         xycoords=trans_right, textcoords=trans_right,
                         ha="left", va="center",
                         arrowprops=arrowprops, bbox=bbox)

I did a bisect and the bad commit was:

3363b125715724ad89d4b33cbddb23e31e7277d5 is the first bad commit
commit 3363b125715724ad89d4b33cbddb23e31e7277d5
Author: Thomas A Caswell <tcaswell@gmail.com>
Date:   Tue Aug 27 17:07:58 2013 -0500

    re factored `_AnnoationBase` to push keeping track of there the
    secondary object is to the sub-classes.

    Added properties to maintain back-compatibility

    added properties to replace xytext and textcoords (xyann, anncoords)

    properly deprecated `textcoord` and `xytext` in favor of `anncoords`
    and `xyann`.

:040000 040000 f17d8e1a70232471435f96b1faa8550bc697ec32 567d4a0a86bb3d1fb7ec55dc0fa98e86c1dec71a M  doc
:040000 040000 34339e9d0d9f49477908fc3c3227b1b7b55735b4 4dc225e1358d422aa86f9361672c36e127955bee M  lib

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions