You could use Python string formatting, like so:

ax.annotate('Time = %s' % Time, size=18, xy=(3, 1),  xycoords='data',
             xytext=(0.8, 0.95), textcoords='axes fraction',
             horizontalalignment='right', verticalalignment='top',
             )



On 04/29/2011 06:54 AM, Pau wrote:
> Hello,
>
> I am trying to print in the plot the value of a time variable which I
> obtain like this
>
> Time       = MBH_inst[0]  # Column 1
>
> This should be placed on the top right part of the plot showing the current 
> time
>
> Time = XXX yrs
>
> But I do not know how to pass this to ax.annotate:
>
> ax.annotate('Time = ', size=18, xy=(3, 1),  xycoords='data',
>              xytext=(0.8, 0.95), textcoords='axes fraction',
>              horizontalalignment='right', verticalalignment='top',
>              )
>
> Thanks,
>
> Pau
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today.  Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>    


-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA


------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to