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

Home » Public Forums » archive » Re: xyouts character size to scale with the size of the plot window
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: xyouts character size to scale with the size of the plot window [message #19192 is a reply to message #19176] Sat, 04 March 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Kristian Kjaer (kristian.kjaer@risoe.dk) writes:

> 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?

I've always had pretty could luck using my Str_Size program,
which I wrote to size the annotation of plots in resizeable
graphics windows. Your application is different from what I had
in mind, although I think Str_Size can be adapted for it. I'm
not sure there is any reliable way to *always* get correctly
sized characters. Too much depends on such other factors, such as
the size of the window, personal aesthetics, etc.

Str_Size works by specifying a string and a "target width"
of that string in the display window. The target width is
given in normalized coordinates. I thought dividing the
target width by the number of columns in the multi-plot
worked reasonably well:

************************************************************ *******
PRO EXAMPLE
window, xsize=500, ysize=500
!p.multi=0
plot,indgen(10)

; Normal target size.

largeCharsize = Str_Size('A String', 0.15)
xyouts,7,3,'A string',/data,charsize=largeCharsize
!p.multi=[0,3,7]
window, 1, xsize=500, ysize=500

; Target size divided by number of columns.

smallCharsize= Str_Size('A String', 0.15/!p.multi[1])
for j=0,20 do begin
plot,indgen(10)
xyouts,7,3,'A string',/data,charsize=smallCharsize
endfor
!P.multi=0
END
************************************************************ *******

You can find Str_Size here:

http://www.dfanning.com/programs/str_size.pro

Cheers,

David




--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Planet movements
Next Topic: Re: suggestions for grabbing license from home

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

Current Time: Sat Oct 11 05:13:55 PDT 2025

Total time taken to generate the page: 0.80097 seconds