[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xyouts character size to scale with the size of the plot window



Kristian,

I think you need to know how many plots you have on
one page. You can access this by

a=!p.multi[1]  ;i.e. 3 in your example
b=!p.multi[2]  ;i.e. 7 in your example
c=a*b  ;21
factor=0.01
xyouts,7,3,'STRING',/data,charsize=.7-factor*c  ;results in a
;smaller character depending on your number of plots on
;the screen

You can now play with the factor for your needs.

Alternatively you could use the system variable !p.clip. It
contains the coordinates of the last plot on the device.
In the example below you have for the first plot the numbers
30 and 290. This is a difference of 260 for the x-size of
your last plot. This difference is constant for the following
plots (e.g. 329 and 589).



!P.CLIP

The device coordinates of the clipping window, a 6-element vector of the
form [(x0, y0, z0), (x1, y1, z1)], specifying two opposite corners of
the volume to be displayed. In the case of two-dimensional displays, the
Z coordinates can be omitted. Normally, the clipping window coordinates
are implicitly set by PLOT, CONTOUR, SHADE_SURF, and SURFACE to
correspond to the plot window. You may also manually set !P.CLIP if you
want to specify a different rectangular clipping window or if the
clipping coordinates have not yet been set in the current IDL session.

IDL> plot, indgen(200)
IDL> print,!p.clip
          30         704         290         811           0        1000
IDL> plot,indgen(200)
IDL> print,!p.clip
         329         704         589         811           0        1000


Ralf Srama




Kristian Kjaer wrote:
> 
> I hope this is not a too FAQ:
> 
> IDL> !p.multi=0
> IDL> plot,indgen(10)
> IDL> xyouts,7,3,'A string',/data,charsize=.7  ; Gives text reasonably
> sized for my purpose
> IDL> !p.multi=[0,3,7]
> IDL> plot,indgen(10)
> IDL> xyouts,7,3,'A string',/data,charsize=.7  ; Gives text which is too
> large for the window.
> 
> How to get the xyouts character size to scale with the size of the plot
> window?
> 
> Thanks for any help.
> Best regards, Kristian Kjr

-- 
ralf.srama@mpi-hd.mpg.de   Tel 49-6221 516 423   Fax 49-6221 516 324
Max-Planck-Institut fuer Kernphysik, Saupfercheckweg 1, 69117
Heidelberg, Germany
CDA-Homepage http://galileo.mpi-hd.mpg.de/cassini
Dust-Group http://galileo.mpi-hd.mpg.de