OBJ_AXIS tick labels [message #14991] |
Tue, 13 April 1999 00:00  |
Pavel Romashkin
Messages: 166 Registered: April 1999
|
Senior Member |
|
|
Hi,
Could anyone tell me: do I really have to individually call SETPROPERTY,
RECOMPUTE=2 for axis tick labels (which, by the way, are not so easily
accessible from an axis object) each time I change viewplane rectangle
(when placing data in PLOT object after initializing it with no data),
or there is a smart way to do that? Once I change the data in a plot
object, re-limit axes and recalculate viewplane rectangle, tick labels
get squeesed. So do axes titles, despite having their RECOMPUTE set to
2. If I set RECOMPUTE to2 after the transformation, everything looks
ok, but shouldn't CHAR_SIZE be recomputed automatically if RECOMPUTE is
set to 2?
I am just beginning with object graphics so please forgive my ignorance.
Thank you,
Pavel
|
|
|
Re: OBJ_AXIS tick labels [message #15072 is a reply to message #14991] |
Wed, 14 April 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Pavel Romashkin (pavel@terra.colorado.edu) writes:
> Dave, do you set viewplane rectangle to [0, 0, 1, 1]? Do you then explicitly
> specify the location for your axis in a view? Default settings ([-1, -1, 2,
> ,2]) do not seem to make sense., axes start in the center of the screen
> then. Well, too many questions I'm afraid. Could you tell me, is there a
> procedure in your archive that does it, which I could examine to see how you
> did it?
For this particular application the viewplane rectangle is set
like this:
plotView = Obj_New('IDLgrView', Viewplane_Rect=[-.35, -.35, 1.6, 1.6], $
Location=[0,0], Color=[80,80,80])
This allows me to scale the data into 0 to 1 and have the
plot fit into the window nicely. (Normalize, which you
can find on my web page, scales into 0 to 1 by default, but
you can also use it to scale into *any* range.) I like to
use the 0 to 1 idea for plots because I'm more familiar with
it.
Sometimes I make the viewplane rectangle coordinates 0 to 1
and then I can "position" things in the window using the
same thinking I use in direct graphics. But, of course,
the coordinate system established by the viewplane rectangle
is completely arbitrary and is set up only for your
own convenience.
You can see how I set up the viewplane rectangle by looking
at the XPLOT program on my web page:
http://www.dfanning.com/programs/xplot.pro
Unfortunately, this doesn't have the ability to change data sets,
so the character dimension recomputing is not implemented there.
Perhaps I'll get around to implementing it as soon as I
pay my taxes. :-(
But what I showed you this morning was from a program that
I just hacked from this one.
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
|
|
|
Re: OBJ_AXIS tick labels [message #15074 is a reply to message #14991] |
Wed, 14 April 1999 00:00  |
Pavel Romashkin
Messages: 166 Registered: April 1999
|
Senior Member |
|
|
David Fanning wrote:
> I tend to
> leave the veiwplane rectangle alone and scale everything
> into it.
Dave, do you set viewplane rectangle to [0, 0, 1, 1]? Do you then explicitly
specify the location for your axis in a view? Default settings ([-1, -1, 2,
,2]) do not seem to make sense., axes start in the center of the screen
then. Well, too many questions I'm afraid. Could you tell me, is there a
procedure in your archive that does it, which I could examine to see how you
did it?
Thank you,
Pavel
|
|
|
Re: OBJ_AXIS tick labels [message #15077 is a reply to message #14991] |
Wed, 14 April 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Pavel Romashkin (pavel@terra.colorado.edu) writes:
> Could anyone tell me: do I really have to individually call SETPROPERTY,
> RECOMPUTE=2 for axis tick labels (which, by the way, are not so easily
> accessible from an axis object) each time I change viewplane rectangle
> (when placing data in PLOT object after initializing it with no data),
> or there is a smart way to do that? Once I change the data in a plot
> object, re-limit axes and recalculate viewplane rectangle, tick labels
> get squeesed. So do axes titles, despite having their RECOMPUTE set to
> 2. If I set RECOMPUTE to2 after the transformation, everything looks
> ok, but shouldn't CHAR_SIZE be recomputed automatically if RECOMPUTE is
> set to 2?
Well, no question you have to recompute the polygons after
you re-scale the axes. I don't know why you have to do
it by hand every time. I've never seen this. Perhaps because
you are recalculating the viewplane rectangle. I tend to
leave the veiwplane rectangle alone and scale everything
into it.
Here is the code I use to define one of my axes. You see how
I get the axes labels and set them to recompute themselves.
The "xtitle" variable is a text object that also has
Recompute_Dimensions set to 2.
xAxis1 = Obj_New("IDLgrAxis", 0, Color=[255,255,0], Ticklen=0.025, $
Minor=4, Range=xrange, Title=xtitle, XCoord_Conv=xs, $
Location=[1000, 0 ,0], /Exact)
xAxis1->GetProperty, Ticktext=xAxisText
helvetica10pt = Obj_New('IDLgrFont', 'Helvetica', Size=10)
xAxisText->SetProperty, Font=helvetica10pt, Recompute_Dimensions=2
After I load new data, I have code that looks something like this.
Normalize is a utility routine that creates scaling factors to
scale the data into 0 to 1, which is appropriate for the
viewplane rectangle I'm using.
info.thisPlot->SetProperty, DataX = x, DataY = y
info.thisPlot->GetProperty, XRange=xrange, YRange=yrange
xs = Normalize(xrange)
ys = Normalize(yrange)
info.thisPlot->SetProperty, XCoord_Conv=xs, YCoord_Conv=ys
info.xaxis1->SetProperty, XCoord_Conv=xs, Range=xrange
info.yaxis1->SetProperty, YCoord_Conv=ys, Range=yrange
The axis labels and titles now appear fine. That is, they
get recomputed correctly and automatically.
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
[Note: This follow-up was e-mailed to the cited author.]
|
|
|