comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Text print in figure with format
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Text print in figure with format [message #92403] Wed, 09 December 2015 04:43 Go to next message
d.poreh is currently offline  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 Go to previous messageGo to next message
greg.addr is currently offline  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 Go to previous message
d.poreh is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDLWAVE tab completion of executive commands
Next Topic: Optimizing loops

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:14:00 PDT 2025

Total time taken to generate the page: 0.00673 seconds