Inconsistency in the position of the text() function [message #91235] |
Fri, 19 June 2015 01:42  |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
Hi,
I'm a bit puzzled by how the position parameter of the text function works.
I expect something and get something else...
Here is a short example:
p = plot(/test)
tl = text(0.5,0.8,'test', alignment=0.0)
tc = text(0.5,0.7,'test', alignment=0.5)
tr = text(0.5,0.6,'test', alignment=1.0)
pl = polyline([0.5,0.5],[0.0,1.0],'r2',/norm)
This is all fine. If I now set the alignment parameter (to the same value!), I get what I expect (no change):
tl.alignment=0.0
tc.alignment=0.5
tr.alignment=1.0
But if I set the position parameter, everything is center justified:
tl.position=[0.5,0.8]
tc.position=[0.5,0.7]
tr.position=[0.5,0.6]
Now the text is centered on the position keyword and the "alignment" parameter is not respected anymore.
Is this what one expects? I didn't expect this...
Cheers,
Helder
|
|
|
Re: Inconsistency in the position of the text() function [message #91248 is a reply to message #91235] |
Mon, 22 June 2015 10:45   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
On Friday, June 19, 2015 at 2:42:23 AM UTC-6, Helder wrote:
> Hi,
> I'm a bit puzzled by how the position parameter of the text function works.
> I expect something and get something else...
> Here is a short example:
>
> p = plot(/test)
> tl = text(0.5,0.8,'test', alignment=0.0)
> tc = text(0.5,0.7,'test', alignment=0.5)
> tr = text(0.5,0.6,'test', alignment=1.0)
> pl = polyline([0.5,0.5],[0.0,1.0],'r2',/norm)
>
> This is all fine. If I now set the alignment parameter (to the same value!), I get what I expect (no change):
>
> tl.alignment=0.0
> tc.alignment=0.5
> tr.alignment=1.0
>
> But if I set the position parameter, everything is center justified:
>
> tl.position=[0.5,0.8]
> tc.position=[0.5,0.7]
> tr.position=[0.5,0.6]
>
> Now the text is centered on the position keyword and the "alignment" parameter is not respected anymore.
>
> Is this what one expects? I didn't expect this...
>
> Cheers,
> Helder
Hi Helder,
This was indeed a bug. It's been fixed for IDL 8.5. Thanks for catching it and providing such a nice reproduce case.
Cheers,
Chris
|
|
|
Re: Inconsistency in the position of the text() function [message #91249 is a reply to message #91248] |
Mon, 22 June 2015 11:38  |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Monday, June 22, 2015 at 7:46:02 PM UTC+2, Chris Torrence wrote:
> On Friday, June 19, 2015 at 2:42:23 AM UTC-6, Helder wrote:
>> Hi,
>> I'm a bit puzzled by how the position parameter of the text function works.
>> I expect something and get something else...
>> Here is a short example:
>>
>> p = plot(/test)
>> tl = text(0.5,0.8,'test', alignment=0.0)
>> tc = text(0.5,0.7,'test', alignment=0.5)
>> tr = text(0.5,0.6,'test', alignment=1.0)
>> pl = polyline([0.5,0.5],[0.0,1.0],'r2',/norm)
>>
>> This is all fine. If I now set the alignment parameter (to the same value!), I get what I expect (no change):
>>
>> tl.alignment=0.0
>> tc.alignment=0.5
>> tr.alignment=1.0
>>
>> But if I set the position parameter, everything is center justified:
>>
>> tl.position=[0.5,0.8]
>> tc.position=[0.5,0.7]
>> tr.position=[0.5,0.6]
>>
>> Now the text is centered on the position keyword and the "alignment" parameter is not respected anymore.
>>
>> Is this what one expects? I didn't expect this...
>>
>> Cheers,
>> Helder
>
> Hi Helder,
>
> This was indeed a bug. It's been fixed for IDL 8.5. Thanks for catching it and providing such a nice reproduce case.
>
> Cheers,
> Chris
Hi Chris,
thanks for that. Helps a lot.
Cheers,
Helder
|
|
|