Closed
Description
I want to annotate a data point with an inset axis (matplotlib-1.4.3, Linux):
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
x=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 what savefig
produces:
Apparently savefig
changes the coordinates (1,0)
from the inset axes to the parent axes for some reason.