The annotation "test" displays if I run the following code:
import matplotlib.pyplot as plt
plt.figure()
ax = plt.gca()
ax.annotate("Test", xy=(0.2, 0.2))
However, the exact same code will not display the annotation if I call plt.plot() instead of plt.figure():
import matplotlib.pyplot as plt
plt.plot()
ax = plt.gca()
ax.annotate("Test", xy=(0.2, 0.2))
Why does the second code block not show the annotation?
plt.show()at the end. Are you using an interactive environment?matplotlib.backends.backendreturns'Qt4Agg'.matplotlib.is_interactive()returnsTrue. Addingplt.show()at the end still leaves the annotation as not displayed for me.TkAggorQt4Agg, version1.2.1on Linux but I getmatplotlib.is_interactive()==Falsewith the default setup. Perhaps it is something to do with interactive mode?[0,1]in the first example with the text within the domain, while in the second example the annotated test is outside the xlim and ylim, that are set to[-.06,.06]. Is this your problem?