|
From: Malte D. <mal...@we...> - 2011-05-01 11:54:17
|
Hi,
Pau <vim...@go...>
> 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',
> )
Maybe like this:
ax.annotate('Time = %f'%(MBH_inst[0],), size=18, xy=(3, 1), xycoords='data',
xytext=(0.8, 0.95), textcoords='axes fraction',
horizontalalignment='right', verticalalignment='top',
)
?
You can also adjust the number of shown digits right of the comma by setting
it up like this: %0.2f etc.
Just look it up in the python documentation (search hints: python string
format).
Wish you the best,
Malte
|