From: Ben A. <bax...@co...> - 2008-08-19 15:37:26
|
When I try using axes.add_artist() to add an Annotation object, it does not work. Adding a Text object in this manner works fine. Shouldn't Annotation also work since it inherits from Text? The sample code below demonstrates. I am using version 0.98.3. from matplotlib.pyplot import figure, show from matplotlib.text import Text from matplotlib.text import Annotation fig = figure() ax = fig.add_subplot(111) text = Text(0, 0, 'This is Text') ann = Annotation('This is an Annotation', (1, 1)) ax.annotate('This is another Annotation', (2, 2)) ax.add_artist(text) ax.add_artist(ann) #this does not work ax.set_xlim(-1, 5) ax.set_ylim(-1, 5) show() |