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

Re: Plotting using Symbols (Object Graphics only)



Hrishikesh P. Gadagkar (gadagkar@my-dejanews.com) writes:

> I wrote an application that contains a scene object consisting of 2
> views. Each view displays a 2D plot drawn with lines/symbols. The
> application was written by combining the sel_obj.pro example from IDL
> and xsurface.pro from David Fanning. For some reason the symbols get
> distorted if not scaled properly. What is the best way to rescale the
> symbols so that they would look the same all the time? The scaling that
> I have used works better for one plot only. Both plots have the same
> number of data points but min/max range is slightly different.

I'm embarrassed to say that even though I had written and
published a program (XPLOT) that supposedly used symbols,
I had never tested it and found (much to my chagrin) that
it didn't work because I didn't even *realize* you had
to size symbols. Sigh... Live and learn.

Anyway, in fooling around with it, I came up with a 
formula for setting the symbol size that seems to work
reasonably well under all the conditions in which I have
tested it. 

The key, it seems to me, is to make the symbols a
consistent size based upon the actual length of the
axes. So, after I get the axes ranges back from the
Axis objects, I find that a value of 0.015 times
the axis range gives a nice symbol size. The advantage
of this is the the symbols don't appear to be
distorted in shape. The code looks something like this:

   xAxis->GetProperty, CRange=xrange
   yAxis->GetProperty, CRange=yrange

    ; Size the symbols appropriately for the plot.

   xSymSize = (xrange[1] - xrange[0]) * 0.015
   ySymSize = (yrange[1] - yrange[0]) * 0.015 
   thisSymbol->SetProperty, Size=[xSymSize, ySymSize]

You can find an updated XPLOT on my web page with the
ability to change and resize symbols:

  http://www.dfanning.com/programs/xplot.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