## [Matplotlib-users] parameters to pylab routines

 [Matplotlib-users] parameters to pylab routines From: Petr Danecek - 2007-01-24 13:55:29 ```Hello, in the code bellow i am trying to achieve a very simple thing: I'd like to call the routine "annotate" to place a text on my plot with arguments supplied by means of a dictionary. Is there a way how to do this? Petr -------------------------------- from pylab import * fig = figure() ax = fig.add_subplot(111, xlim=(-1,5), ylim=(-3,5)) t = nx.arange(0.0, 5.0, 0.01) s = nx.cos(2*nx.pi*t) ax.plot(t, s, lw=3, color='purple') ax.annotate('text', xy=(1,0.5)) ax.annotate('text', xy=(2,0.5), rotation=45) # But this does not work: # opts = dict(rotation=45) # ax.annotate('text', xy=(3,2), opts) # # and nor does this: # opts = {'xy':(3,2),'rotation':45} # ax.annotate('text',opts) show() ```

 [Matplotlib-users] parameters to pylab routines From: Petr Danecek - 2007-01-24 13:55:29 ```Hello, in the code bellow i am trying to achieve a very simple thing: I'd like to call the routine "annotate" to place a text on my plot with arguments supplied by means of a dictionary. Is there a way how to do this? Petr -------------------------------- from pylab import * fig = figure() ax = fig.add_subplot(111, xlim=(-1,5), ylim=(-3,5)) t = nx.arange(0.0, 5.0, 0.01) s = nx.cos(2*nx.pi*t) ax.plot(t, s, lw=3, color='purple') ax.annotate('text', xy=(1,0.5)) ax.annotate('text', xy=(2,0.5), rotation=45) # But this does not work: # opts = dict(rotation=45) # ax.annotate('text', xy=(3,2), opts) # # and nor does this: # opts = {'xy':(3,2),'rotation':45} # ax.annotate('text',opts) show() ```
 Re: [Matplotlib-users] parameters to pylab routines From: Petr Danecek - 2007-01-24 14:16:32 ```The correct answer is bellow, sorry for bothering. petr On Wed, 2007-01-24 at 14:55, Petr Danecek wrote: > Hello, > in the code bellow i am trying to achieve a very simple thing: I'd like > to call the routine "annotate" to place a text on my plot with arguments > supplied by means of a dictionary. > Is there a way how to do this? > Petr xy=(3,0.5) opts = {'xy':xy,'rotation':45} ax.annotate('text',**opts) ```

JavaScript is required for this form.

No, thanks