Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Labels
Description
I want to annotate a data point with an inset axis (matplotlib-1.4.3, Linux):
import matplotlib.pyplot as pltimport numpy as npfrom mpl_toolkits.axes_grid1.inset_locator import inset_axesx=np.linspace(0,10,200)y=np.exp(-x)*np.sin(x)fig,ax = plt.subplots(figsize=(3.39,3))ax.plot(x,y)axins=inset_axes(ax, width=0.6, height=0.6, bbox_to_anchor=(6, 0.2),bbox_transform=ax.transData)axins.axes.get_xaxis().set_visible(False)axins.axes.get_yaxis().set_visible(False)ax.annotate("",xy=(x[150],y[150]), xycoords=ax.transData, xytext=(1, 0), textcoords=axins.transAxes, arrowprops=dict(arrowstyle="->"))fig.savefig('example.pdf')plt.show()
This is the correct plot shown on screen:
This is whatsavefig
produces:
Apparentlysavefig
changes the coordinates(1,0)
from the inset axes to the parent axes for some reason.