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

Home » Public Forums » archive » text inversion when inverting axis
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 inversion when inverting axis [message #88655] Mon, 26 May 2014 09:39 Go to next message
Jahvasc is currently offline  Jahvasc
Messages: 9
Registered: March 2014
Junior Member
Hi, I'm trying to make a plot with decreasing values in the x-direction. No problem with this. The problem arises when I use "text" function to write down an annotation to the plot window. Here, I give a very simple example:

a=findgen(10)
b=sqrt(a)
pl=plot(a,b,xrange=[9,0])
tx=text(0.1*max(pl.xrange),0.9*max(pl.yrange),'b=sqrt(a)',/d ata)

I get it also inverted! Am I doing something wrong?
Thanks!
Re: text inversion when inverting axis [message #88656 is a reply to message #88655] Mon, 26 May 2014 10:08 Go to previous messageGo to next message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
My impression is that the text function likes to draw from the minimum value towards maximum value when the DATA keyword is being used. To fix this, you can try changing the orientation of the text. This is what worked for me

a=Findgen(10)
b=Sqrt(a)
pl=Plot(a, b, XRANGE=[9,0])
tx=Text(2, 2.5, 'b=sqrt(a)', /DATA, BASELINE=[1,0,0], ORIENTATION=45)


Note that the docs say that BASELINE=[1,0,0] is the default. However, the following two lines have different results (for me, on IDL 8.2).

tx1=Text(2, 2.5, 'b=sqrt(a)', /DATA, ORIENTATION=45, BASELINE=[1,0,0])
tx2=Text(2, 2.5, 'b=sqrt(a)', /DATA, ORIENTATION=45)
Re: text inversion when inverting axis [message #88658 is a reply to message #88656] Mon, 26 May 2014 10:18 Go to previous messageGo to next message
Jahvasc is currently offline  Jahvasc
Messages: 9
Registered: March 2014
Junior Member
Yes, since I'm using the same version you are, I also have to use both, baseline and orientation.
Thank you very much!
Re: text inversion when inverting axis [message #88659 is a reply to message #88656] Mon, 26 May 2014 10:43 Go to previous message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
> Note that the docs say that BASELINE=[1,0,0] is the default. However, the following two lines have different results (for me, on IDL 8.2).
>
> tx1=Text(2, 2.5, 'b=sqrt(a)', /DATA, ORIENTATION=45, BASELINE=[1,0,0])

Actually, any orientation between 1 and 89 give me the same results.

Any value of ORIENTATION between 90 and 179 give another fixed orientation
..................................180
..................................181 and 269
..................................270
..................................271 and 359


The following line also gives the results you desire, and should be less dependent on the glitchy behavior

tx=text(2, 2.5, 'b=sqrt(a)', /data, ORIENTATION=180, UPDIR=[0,1,0])

Note again, however, that UPDIR=[0,1,0] should be the default. The following two lines give different results, though

tx1=text(2, 2.5, 'b=sqrt(a)', /data, ORIENTATION=180)
tx2=text(2, 2.5, 'b=sqrt(a)', /data, ORIENTATION=180, UPDIR=[0,1,0])
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Having READ ingest the input without waiting for return key to be hit?
Next Topic: idl crashes

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

Current Time: Wed Oct 08 15:07:44 PDT 2025

Total time taken to generate the page: 0.00474 seconds