Re: IDLgrAxis question. [message #38150 is a reply to message #38076] |
Sat, 21 February 2004 08:21   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Matt Savoie writes:
> O.k. I've been pulling hair and beating my head over this for a while, and I
> think if I ask, someone here will probably be able to tell me right away. I
> want to be able to change the range of an axis from within a widget program.
> I am doing this with the setProperty procedures of the axis and plot. After
> I do this, the yfonts get all screwy. (that's the technical term.)
>
> I'm running into this problem on IDL Version 6.0 (linux x86 m32).
>
> I have just taken Ronn Kling's example program and hacked it to show you what
> I mean.
>
> Please tell me what I'm doing wrong before I get any balder?
I'm not sure baldness (or more people wanting to love and
and make commitments to one another, to chose another problem
in the news) is the biggest problem we have in the world,
but I'll try to do my part. :-)
When you change the axis range, you must also recompute
the "dimensions" of the characters used to label the axis,
because the "size" of the labels is based on the range of
the data. Here is an article about the problem:
http://www.dfanning.com/ographics_tips/font_dimensions.html
I fixed your program by changing this:
;;create a text object
oTextY = obj_new('IDLgrText', 'Y Axis', FONT = theFont)
;;create an axis object
oAxisY = obj_new('IDLgrAxis', 1, range = yrange, $
ycoord_conv = ys, exact = 1, $
title = oTextY)
;;add it to the model
oModel -> add, oAxisY
To this:
;;create a text object
oTextY = obj_new('IDLgrText', 'Y Axis', FONT = theFont, $
Recompute_Dimensions=2)
;;create an axis object
oAxisY = obj_new('IDLgrAxis', 1, range = yrange, $
ycoord_conv = ys, exact = 1, $
title = oTextY)
;; get the axis labels so you can recompute these labels, too.
oAxisY -> GetProperty, TickText=labels
labels -> SetProperty, Recompute_Dimensions=2
;;add it to the model
oModel -> add, oAxisY
Cheers,
David
P.S. Let's just say I'm interested in the psychology of someone who
finds "I love you" to be infinitely more frightening than "I'm a
war president."
P.S.S. Before you write in, I'm aware this is the wrong forum, etc.,
etc. It's just that when I get back from a trip late at night, it is
my habit to read the newspapers that have accumulated in my absence.
It's just on my mind, and seems more important to me this morning
than IDL programming. I'll probably get my priorities straightened
out again in a day or two. :-)
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|