Text print in figure with format [message #92403] |
Wed, 09 December 2015 04:43  |
d.poreh
Messages: 406 Registered: October 2007
|
Senior Member |
|
|
Folks
Hi,
I need to have a format like this:
.....
str='$\rho=$'+string(corr)
subtitle = text(0.24, 0.8, str, /bold,FORMAT='(F5.2)' ,font_size=12)
but it is not working in IDL. it shows like 0.64232, but i need two decimal digits.
Will u pls help?
Best,
Dave
|
|
|
Re: Text print in figure with format [message #92404 is a reply to message #92403] |
Wed, 09 December 2015 05:00   |
greg.addr
Messages: 160 Registered: May 2007
|
Senior Member |
|
|
On Wednesday, December 9, 2015 at 1:44:00 PM UTC+1, dave poreh wrote:
> Folks
> Hi,
> I need to have a format like this:
> .....
> str='$\rho=$'+string(corr)
> subtitle = text(0.24, 0.8, str, /bold,FORMAT='(F5.2)' ,font_size=12)
>
> but it is not working in IDL. it shows like 0.64232, but i need two decimal digits.
> Will u pls help?
> Best,
> Dave
It's because you're making your string before you apply the format code. Do it in the string() call:
IDL> a=0.64232
IDL> str=string(a,format="(f5.2)")
IDL> str
0.64
cheers,
Greg
|
|
|
Re: Text print in figure with format [message #92405 is a reply to message #92404] |
Wed, 09 December 2015 07:49  |
d.poreh
Messages: 406 Registered: October 2007
|
Senior Member |
|
|
Thanks Greg,
That was the point :)
Cheers,
Dave
On Wednesday, December 9, 2015 at 2:00:43 PM UTC+1, greg...@googlemail.com wrote:
> On Wednesday, December 9, 2015 at 1:44:00 PM UTC+1, dave poreh wrote:
>> Folks
>> Hi,
>> I need to have a format like this:
>> .....
>> str='$\rho=$'+string(corr)
>> subtitle = text(0.24, 0.8, str, /bold,FORMAT='(F5.2)' ,font_size=12)
>>
>> but it is not working in IDL. it shows like 0.64232, but i need two decimal digits.
>> Will u pls help?
>> Best,
>> Dave
>
> It's because you're making your string before you apply the format code. Do it in the string() call:
>
> IDL> a=0.64232
> IDL> str=string(a,format="(f5.2)")
> IDL> str
> 0.64
>
> cheers,
> Greg
|
|
|