Re: Strange positioninig with xyouts [message #46623] |
Thu, 01 December 2005 05:18  |
K. Bowman
Messages: 330 Registered: May 2000
|
Senior Member |
|
|
In article <1133431475.452885.103440@g47g2000cwa.googlegroups.com>,
"Darius" <write2darius@gmail.com> wrote:
> Dear group,
>
> how do I get the asterisk to be at 10.0, 10.0 and not at 10.0, 10.5?
> And, the larger the charsize the higher the asterisk in the
> y-direction.
> BTW, I use IDL 6.0 on WinXP.
>
> pro test_xyouts
> loadct, 13
> x = indgen(20)
> _10 = MAKE_ARRAY(20, /INTEGER, VALUE = 10)
> set_plot, 'ps'
> device, filename='test_xyouts.ps', /color
> plot, x, _10, xrange=[0,20], yrange=[0,20]
> oplot, _10, x
> xyouts, 10.,10., '*', /data, charsize=1, FONT=0.0, ALIGNMENT=0.5,
> color=250
> device, /close
> end
>
>
> Cheers, Darius
Since an asterisk is drawn at the top of the "character box", for example, x*,
it won't be centered at the plotting location unless you adjust for the
character size.
Have you tried using PSYM = 2? Symbols are centered at the plotting location.
IDL> plot, [-1,1],[-1,1],/nodata
IDL> plots, [-1,1],[0,0],psym=-3
IDL> plots, [0,0],[-1,1],psym=-3
IDL> plots, 0, 0, psym=2
Ken Bowman
|
|
|
|
Re: Strange positioninig with xyouts [message #46625 is a reply to message #46623] |
Thu, 01 December 2005 05:09  |
rm
Messages: 4 Registered: June 2005
|
Junior Member |
|
|
Hows about using device coordinates
scale=0.5
pos=CONVERT_COORD(10,10, /data, /to_device)
XYOUTS, pos[0], pos[1]-!d.y_ch_size*scale, /device, '*', align=0.5
you might need to modify scale, as the character might not be
vertically centered
Or alternatively if all you want to do is put a symbol at (10,10) then
use the PLOTS command
PLOTS, 10, 10, psym=2
|
|
|