-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Arrow annotations behave differently between 1.3.1 and 1.4.2 #4012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
man, that commit message is embarrassing ... |
I suspect something subtle got broken when annotations changed from a 'has-a' to 'is-a' My guess is that something changed about where the base of the arrow is calculated and poor interaction with the I am some what more distressed by the extra blue lines around the vertical blue dashed lines. |
in (mostly notes to my self) |
"something changed about where the base of the arrow is calculated" This sounds familiar. I think we fixed a real bug wrt how the arrow was On Mon, Jan 19, 2015 at 11:49 AM, Thomas A Caswell <[email protected]
|
@WeatherGod How recently? |
Perhaps this (or one of the ones referenced in it)? On Mon, Jan 19, 2015 at 2:57 PM, Thomas A Caswell [email protected]
|
For a simpler example, I took the import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
fig = plt.figure()
ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1,5), ylim=(-3,5))
t = np.arange(0.0, 5.0, 0.01)
s = np.cos(2 * np.pi * t)
ax.plot(t, s, lw=3, color='purple')
arrowprops = dict(arrowstyle="wedge,tail_width=1.4,shrink_factor=0.8")
ax.annotate('axes center', xy=(.5, .5), xycoords='axes fraction',
horizontalalignment='center', verticalalignment='center',
arrowprops=arrowprops)
ax.annotate('pixels', xy=(20, 20), xycoords='figure pixels',
arrowprops=arrowprops)
ax.annotate('points', xy=(100, 300), xycoords='figure points',
arrowprops=arrowprops)
ax.annotate('offset', xy=(1, 1), xycoords='data',
xytext=(-15, 10), textcoords='offset points',
horizontalalignment='right', verticalalignment='bottom',
arrowprops=arrowprops)
ax.annotate('local max', xy=(3, 1), xycoords='data',
xytext=(0.8, 0.95), textcoords='axes fraction',
horizontalalignment='right', verticalalignment='top',
arrowprops=arrowprops)
ax.annotate('a fractional title', xy=(.025, .975),
xycoords='figure fraction',
horizontalalignment='left', verticalalignment='top',
fontsize=20,
arrowprops=arrowprops)
ax.annotate('bottom right (points)', xy=(-10, 10),
xycoords='axes points',
horizontalalignment='right', verticalalignment='bottom',
fontsize=20,
arrowprops=arrowprops)
plt.show() I'm not sure if this adequately replicates the above issue, but it does point to |
Yea, that's odd too. I will try to see where those lines originate. |
I honestly don't know where these are from, and they stopped showing up, so I wouldn't worry about them. |
this seems to be fixed by #4019 |
Digging into this I still have no idea what the problem is. My suspicion is that something I changed had a crucial side effect... |
I am going to take one more pass at this tomorrow, if I can't figure it out I am going to boot this to 1.4.x as this seems to be only an issue when using both the |
attn @leejjoon Can you point me in the right direction on this? I think something in getting out of sync in updating where the center of the text is with the bounding box. |
I am more concerned about the shift in the plotted line. Did you make the diff from my png, or from running it on your system? |
From running it on my system, using the original |
On 2015/07/22 10:47 AM, Thomas A Caswell wrote:
That looks to me like a difference in rendered width, not in position. |
If you're really interested in the shift, the bisect was inconclusive: There are only 'skip'ped commits left to test. |
…rds" This reverts commit d6e1577, reversing changes made to b280f7d. For 1.4.0 tacaswell refactored annotations (matplotlib#2351 ) but missed that {'axes points', 'axes pixel', 'figure points', 'figure pixel'} were special cased to wrap. Presumably from the function name to maintain back compatibility. This was an unintentional and undocumented API break. This API break was noticed in matplotlib#4012 and fixed in matplotlib#4019 but that catches too many of the coordinate systems (should not be all things that start with 'axes') so fixed one API, but broke others. There were two reasonable courses of action: 1. revert back to 1.4.2 behavior with nothing wrapping. 2. revert back to 1.3.1 behavior with somethings wrapping. In the discussion in matplotlib#4292 where the consensus was to go with option 1, hence this reversion.
Closing this as 'good enough'. @QuLogic Please ping to have this re-opened if you disagree. |
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 runTest case is below.obspy3-runtests -d obspy.station.tests.test_station.StationTest.test_response_plot
.With mpl 1.3.1, the plot is as so:

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

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:
I did a bisect and the bad commit was:
The text was updated successfully, but these errors were encountered: